Dependencies conflict on app release APK, but not debug? - java

I have been tinkering with my code for a few days now, and I cannot get Gradle to assemble a signed APK for me (following the error code instructions will result in a successful build, but my Google Calendar API fails).
dependencies {
// commented stuff is no longer used or commented for some other reason.
//compile 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
// Dont know whats up with these errors above. ^
// they seem to work even though they are "incompatible"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.code.findbugs:jsr305:3.0.1'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude module: 'guava-jdk5'
//exclude group: 'org.apache.httpcomponents'
}
implementation 'com.android.support:multidex:1.0.3'
//implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.android.support:cardview-v7:28.0.0'
//implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.bartoszlipinski.constraint:staggeredanimationgroup:1.0.0'
implementation 'com.android.support:transition:28.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.3'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.1'
implementation 'com.google.firebase:firebase-core:16.0.3'
/*Make sure these are always updated to the newest versions.*/
implementation('com.google.oauth-client:google-oauth-client-jetty:1.23.0') {
exclude module: 'guava-jdk5'
}
implementation('com.google.apis:google-api-services-calendar:v3-rev305-1.23.0') {
exclude module: 'guava-jdk5'
}
//implementation 'pub.devrel:easypermissions:0.3.0'
implementation 'com.google.http-client:google-http-client-jackson:1.15.0-rc'
//implementation 'com.google.android.gms:play-services-auth:16.0.0'
These are my dependencies from my Gradle files.
Ignore the error on 'com.android.support:support-vector-drawable:28.0.0' because its fine; I just can't get my APK to assemble signed; and when it's forced, my Google Calendar code does not return events.
Executing tasks: [:app:assembleRelease]
Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
:app:checkReleaseClasspath
:app:preBuild UP-TO-DATE
:app:preReleaseBuild
:app:compileReleaseAidl NO-SOURCE
:app:compileReleaseRenderscript UP-TO-DATE
:app:checkReleaseManifest UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:mainApkListPersistenceRelease UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:processReleaseGoogleServices
Parsing json file: C:\Users\Dylan\Documents\ClarenceFultonSecondary\app\google-services.json
:app:mergeReleaseResources
:app:createReleaseCompatibleScreenManifests UP-TO-DATE
:app:processReleaseManifest
:app:splitsDiscoveryTaskRelease UP-TO-DATE
:app:processReleaseResources
:app:generateReleaseSources
:app:javaPreCompileRelease
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileReleaseJavaWithJavac
:app:compileReleaseNdk NO-SOURCE
:app:compileReleaseSources
C:\Users\Dylan\Documents\ClarenceFultonSecondary\app\build.gradle: Error: commons-logging defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]
C:\Users\Dylan\Documents\ClarenceFultonSecondary\app\build.gradle: Error: httpclient defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]
Explanation for issues of type "DuplicatePlatformClasses":
There are a number of libraries that duplicate not just functionality of
the Android platform but using the exact same class names as the ones
provided in Android -- for example the apache http classes. This can lead
to unexpected crashes.
To solve this, you need to either find a newer version of the library which
no longer has this problem, or to repackage the library (and all of its
dependencies) using something like the jarjar tool, or finally, rewriting
the code to use different APIs (for example, for http code, consider using
HttpUrlConnection or a library like okhttp).
2 errors, 0 warnings
:app:lintVitalRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
Lint found fatal errors while assembling a release target.
To proceed, either fix the issues identified by lint, or modify your build script as follows:
...
android {
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
...
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 31s
This is what my lint report says:
Duplicate Platform Classes
../../build.gradle: commons-logging defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar.
../../build.gradle: httpclient defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar.

Add the following code in app/build.gradle.
configurations {
all {
exclude module: 'httpclient'
exclude module: 'commons-logging'
}
}

Related

Execution failed for task ':Launcher.main()'. > Process 'command 'C:/Program Files/Java/jdk-19/bin/java.exe'' finished with non-zero exit value 1

I'm following a tutorial on LWJGL and I'm trying to run the project with gradle 7.6 and Java JDK 19.
I'm getting the error log
11:56:12 AM: Executing task ':Launcher.main() --scan'...
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :Launcher.main() FAILED
3.3.1 build 7
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings
2 actionable tasks: 1 executed, 1 up-to-date
[LWJGL] Failed to load a library. Possible solutions:
a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath.
b) Add the JAR that contains the shared library to the classpath.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to locate library: lwjgl.dll
at org.lwjgl.system.Library.loadSystem(Library.java:164)
at org.lwjgl.system.Library.loadSystem(Library.java:63)
at org.lwjgl.system.Library.<clinit>(Library.java:51)
at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:100)
at org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:67)
at org.lwjgl.system.Callback.<clinit>(Callback.java:40)
at edu.vanier.engine.WindowManager.init(WindowManager.java:35)
at edu.vanier.test.Launcher.main(Launcher.java:12)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Launcher.main()'.
> Process 'command 'C:/Program Files/Java/jdk-19/bin/java.exe'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service. Do you accept these terms? [yes, no]
Here's the build.gradle per request
plugins {
id 'java'
id 'application'
}
project.ext.lwjglVersion = "3.3.1"
project.ext.jomlVersion = "1.10.5"
project.ext.lwjglNatives = "natives-windows"
repositories {
mavenCentral()
}
dependencies {
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
implementation "org.lwjgl:lwjgl"
implementation "org.lwjgl:lwjgl-assimp"
implementation "org.lwjgl:lwjgl-bgfx"
implementation "org.lwjgl:lwjgl-cuda"
implementation "org.lwjgl:lwjgl-egl"
implementation "org.lwjgl:lwjgl-glfw"
implementation "org.lwjgl:lwjgl-jawt"
implementation "org.lwjgl:lwjgl-jemalloc"
implementation "org.lwjgl:lwjgl-libdivide"
implementation "org.lwjgl:lwjgl-llvm"
implementation "org.lwjgl:lwjgl-lmdb"
implementation "org.lwjgl:lwjgl-lz4"
implementation "org.lwjgl:lwjgl-meow"
implementation "org.lwjgl:lwjgl-meshoptimizer"
implementation "org.lwjgl:lwjgl-nanovg"
implementation "org.lwjgl:lwjgl-nfd"
implementation "org.lwjgl:lwjgl-nuklear"
implementation "org.lwjgl:lwjgl-odbc"
implementation "org.lwjgl:lwjgl-openal"
implementation "org.lwjgl:lwjgl-opencl"
implementation "org.lwjgl:lwjgl-opengl"
implementation "org.lwjgl:lwjgl-opengles"
implementation "org.lwjgl:lwjgl-openvr"
implementation "org.lwjgl:lwjgl-openxr"
implementation "org.lwjgl:lwjgl-opus"
implementation "org.lwjgl:lwjgl-ovr"
implementation "org.lwjgl:lwjgl-par"
implementation "org.lwjgl:lwjgl-remotery"
implementation "org.lwjgl:lwjgl-rpmalloc"
implementation "org.lwjgl:lwjgl-shaderc"
implementation "org.lwjgl:lwjgl-spvc"
implementation "org.lwjgl:lwjgl-sse"
implementation "org.lwjgl:lwjgl-stb"
implementation "org.lwjgl:lwjgl-tinyexr"
implementation "org.lwjgl:lwjgl-tinyfd"
implementation "org.lwjgl:lwjgl-tootle"
implementation "org.lwjgl:lwjgl-vma"
implementation "org.lwjgl:lwjgl-vulkan"
implementation "org.lwjgl:lwjgl-xxhash"
implementation "org.lwjgl:lwjgl-yoga"
implementation "org.lwjgl:lwjgl-zstd"
runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-bgfx::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-jemalloc::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-libdivide::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-llvm::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-lmdb::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-lz4::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-meow::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-meshoptimizer::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-nanovg::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-nfd::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-nuklear::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-opengles::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-openvr::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-openxr::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-opus::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-ovr::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-par::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-remotery::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-rpmalloc::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-shaderc::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-spvc::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-sse::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-tinyexr::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-tinyfd::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-tootle::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-vma::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-xxhash::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-yoga::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-zstd::$lwjglNatives"
implementation "org.joml:joml:${jomlVersion}"
}
test {
useJUnitPlatform()
}
I've tried every solution I saw online, from updating my Intellij IDE, updating the gradle and JDK versions, updating my JRE. Invalidating caches. I'm really at a dead end here. Any help would be appreciated thanks.
You don't mention what steps you followed to build the project, nor can we see your build.gradle file or the project's structure, but it looks like you tried to manually do some things, unsuccessfully.
In any case, the LWJGL website provides a configurator that simplifies the whole process.
If you want to use Gradle, choose the "Gradle" mode in the generator. This will result in a portion of a build.gradle script containing dependency declarations for all selected modules and platforms, which you can copy/paste into your build.gradle file and use it to build your project.
Note that when using Gradle, you probably want to prepend apply plugin: 'java' and apply plugin: 'application' to the build.gradle file.
Following the above should result in a successful build in IntelliJ, but if not, you can try a custom configuration, following the instructions below (as indicated on LWJGL-Wiki):
Go to the configurator's page, select Zip Bundle, review the options and choose the bindings you're interested in, then click on DOWNLOAD ZIP.
When the download is complete, extract its contents into your project.
In IntelliJ, go to Project Structure > Libraries > New Project Library. Add all LWJGL .jar files (classes+natives) to the library and add the library as a dependency to your project module(s). You do not need to extract the native libraries.
If you also downloaded the sources, add the corresponding .jar files as sources to the LWJGL library. You do not need to download and attach the javadoc .jar files, IntelliJ generates javadoc directly from sources.
The problem was with an error being incorrectly thrown. It had nothing to do with LWJGL or Gradle.

Error: Program type already present: com.google.firebase.auth.FirebaseAuthException

I am getting following error while building my project while I haven't used firebase auth in my project:
Error: Program type already present: com.google.firebase.auth.FirebaseAuthException
I have tried following but nothing seems to work
Use navigation option
clean rebuild
invalid cache
exclude group module
my dependencies are as:
dependencies {
implementation fileTree( dir: 'libs',include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'android.arch.lifecycle:extensions:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.2'
implementation ('com.google.firebase:firebase-admin:6.8.0'){
exclude module:'com.google.firebase-auth'
}
}
implementation 'com.google.firebase:firebase-firestore:19.0.1'
You can't use the Firebase Admin SDK in an Android app. It can only be used in a trusted environment, such as your development machine, a server you control, or Cloud Functions.
If you remove this dependency, the error should disappear:
implementation ('com.google.firebase:firebase-admin:6.8.0'){
This problem usually come from a naming conflict (Most probably because a class appears more than once in your project either in the form of dependencies or a mistake).
To find the list of dependencies for the module 'x' we can run
./gradlew x:dependencies to retrieve a list of all the libraries.
From the dependency tree, you an figure out if there is a class/library with the same name being used by two libraries. Based on this finding, you can choose to exclude the module in one of the libraries that are causing the conflict.

Error [duplicateplatformclasses] while building app in release mode

After updating Android Studio and updated GDAA to Google Drive REST API as GDAA is deprecated, but now I can not build my app in release mode which had no issues before. Here is the complete error message:
org.gradle.api.GradleException: Lint found fatal errors while assembling a release target. To proceed, either fix the issues identified by lint, or modify your build script as follows:
...
android {
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
And in the lint-results-release-fatal.xml file I get these messages:
'commons-logging' defines classes that conflict with classes now
provided by Android. Solutions include finding newer versions or
alternative libraries that don't have the same problem (for example,
for httpclient use HttpUrlConnection or okhttp instead), or
repackaging the library using something like jarjar.
'httpclient' defines classes that conflict with classes now provided
by Android. Solutions include finding newer versions or alternative
libraries that don't have the same problem (for example, for
httpclient use HttpUrlConnection or okhttp instead), or repackaging
the library using something like jarjar.
Here is my gradle dependencies:
dependencies {
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:support-core-utils:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-ads:17.1.3'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.http-client:google-http-client-gson:1.26.0'
implementation('com.google.api-client:google-api-client-android:1.26.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-drive:v3-rev136-1.25.0') {
exclude group: 'org.apache.httpcomponents'
}
}
I tried this and this but no luck.
After trying all other solutions with no luck, I suddenly discovered that this version of Android Studio 3.3.2 does not detect libraries which are out of date and found that the library causing the problem was this:
implementation 'com.google.http-client:google-http-client-gson:1.26.0'
As this is the suspected library from this question.
I simply updated this library to the latest version which is this at the moment:
implementation 'com.google.http-client:google-http-client-gson:1.28.0'
And the problem was solved.
I post this question and give answer just because I could not find the right answer and for those struggling with the same problem could be the right solution.

Android Gradle ResolutionStrategy force stil downloads previous version of lib

I have forced in my gradle to download this version of jsr305 as follows :
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
I see that when I try to compile the gradle is resolving the version :
Inspite of that I see that during gradle sync the older versions (2.0.1 & 1.3.9) are still getting downloaded :
I am getting compile errors as follows :
com.android.build.api.transform.TransformException:
Error while generating the main dex list.
com.android.tools.r8.errors.CompilationError: Program type already present: javax.annotation.CheckForNull
Program type already present: javax.annotation.CheckForNull
I did a module level search and found that the CheckForNull.java is present at multiple places in
jsr305/2.0.1
jsr305/3.0.1
jsr305/1.3.9
I have tried deleting ./gradle folder and resync the project. I see that gradle still downloads the previous jsr305 version.
These are my dependencies in gradle :
implementation "com.facebook.react:react-native:${versions.reactNative}"
implementation ("com.google.code.findbugs:annotations:3.0.1") {
exclude group: 'net.jcip', module: 'jcip-annotations'
}
My questions :
Why is Gradle still downloading the older version of jsr305 ?
And in spite of the jsr305 version getting resolved why is multidex throwing that error ?
Created a test project that shows the behavior where the old lib versions are downloaded even after the forced resolution:
https://github.com/vineyugave/scratchpad
Also you can see the gradle scan here :
https://scans.gradle.com/s/tzrobr2zuar3c/dependencies?dependencies=jsr&expandAll
module :firstlib references implementation "com.google.code.findbugs:jsr305:2.0.0",
which should possibly be implementation "com.google.code.findbugs:jsr305:3.0.2" ...but the other one build.gradle does not really match the question, because it lacks react-native.
the dependencies of module :app should look alike (only the changes):
dependencies {
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation "com.android.support:support-v4:28.0.0"
implementation ("com.facebook.react:react-native:0.20.1") {
exclude group: "com.android.support", module: "recyclerview-v7"
exclude group: "com.android.support", module: "support-v4"
}
//noinspection GradleDependency
implementation "com.google.guava:guava:24.1-android"
}
configurations.all {
resolutionStrategy.force "com.google.code.findbugs:jsr305:3.0.2"
resolutionStrategy.force "com.google.guava:guava:24.1-android"
}
it's downloading elder versions, because they would need to be explicitly excluded from the dependencies, which demand them (as demonstrated above). one can list them all with ./gradlew app:dependencies and then exclude them accordingly.
task :app:transformClassesWithMultidexlistForDebug failed, because of support-library version conflicts caused by react-native (already fixed in the above example).
when moving those jniLibs from armeabi into armeabi-v7a, it wouldn't complain about a missing stripping tool anymore. however, then they wouldn't be loaded on arm64-v8a anymore.

Failed to resolve: com.android.support:support-v4:26.0.2

when i use this library :
compile 'co.ronash.android:pushe-base:1.4.0'
I get this error in gradle:
Failed to resolve: com.android.support:support-v4:26.0.2
I can't fix it.
There is a solution to be there library Ignored
'com.android.support:support-v4:26.0.2' from 'co.ronash.android:pushe-base:1.4.0' ?
Because I have already compiled a newer version of support-v4 library.
All my dependencies code in gradle :
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:support-v4:26.+' //--> its ok and no problem
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'co.ronash.android:pushe-base:1.4.0' //--->this code is error Failed to resolve: com.android.support:support-v4:26.0.2
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
testCompile 'junit:junit:4.12'
}
There are a few reasons which can cause this kind of problem.
Checkout these solution, I guess it might help you:
1. Remove Pushe and try adding support-v4 library with version of 26.0.2 to make sure it gets downloaded and cached to your system.
compile 'com.android.support:support-v4:26.0.2' // or implementation
If it still can't be resolved then you have a problem getting it from it's repository server. checkout build.gradle(project:your_prj) and make sure this block is valid.
allprojects {
repositories {
google() // or maven { url 'https://maven.google.com/' } for lower gradles
jcenter()
}
}
If your country is included in sanction you might need to use a VPN to be able to get them. You can also use a proxy like Fod(also donate if you can since it's opensource) or shecan.
Remember all support libraries better be 26.0.2 to avoid conflict and crashing. Your support libraries are 26.0.0-alpha1 which is lower.
After you successfully added and cached support-v4 then try to add Pushe to your dependencies again.
! And also remember that pushe has a support-v4 bundled in it and it's not really needed for you to add it yourself
And Make sure you have
<uses-sdk tools:overrideLibrary="co.ronash.pushe" />
in you manifest. Therefore you can override it's libraries and dependencies.
At the end keep your SDK update.
Edit:
Current version of Pushe is using android support libraries. If you attend to use AndroidX be sure to enable jettifier in order to do runtime conversion.

Categories

Resources