Incompatible Gradle Versions in android studio [duplicate] - android

This question already has answers here:
All com.android.support libraries must use the exact same version specification
(54 answers)
Closed 4 years ago.
i was trying to make google map program and it gives that error
../../build.gradle: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).
Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:26.1.0
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "GradleCompatible" as explained in the Suppressing Warnings and Errors section.
the versions
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
}

You need to exclude com.android.support dependency from esspresso-core like below:
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
This will fix your issue.

If you don't use Unit and Local testing then just remove these testing libraries. Your gradle will look like.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
}

Related

`android.support` cannot mix different versions

I have following dependencies in my android studio project.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.google.android.gms:play-services:11.8.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'
}
I just added com.google.android.gms:play-services and I can't figure out why the following error is occuring:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 25.2.0. ...
Does anyone know how to solve this problem. I assume it has got to do with the play services dependency using a different versions of android.support, or something similar, but can't find a single solution on the internet.
P.S I'm using kotlin if that makes any difference

Android SDK version 28 does not support play-service-auth:16.0.1

I'm trying to include 'play-service-auth:16.0.1' library in my android project but there is no support for android SDK version 28. I'm getting following error :
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 28.0.0, 26.1.0. Examples include
com.android.support:animated-vector-drawable:28.0.0 and
com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1)
Inspection info:There are some combinations of libraries, or tools and
libraries, that are incompatible, or can lead to bugs. One such
incompatibility is compiling with a version of the Android support
libraries that is not the latest version (or in particular, a version
lower than your targetSdkVersion). Issue id: GradleCompatible
Following are my dependencies :
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0' // <- Error
implementation 'com.android.support.constraint:constraint-layout:1.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'
}
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'
}
I've tried looking for latest version of 'play-services-auth' but 16.0.1 seems to be the latest version. Does anyone have any idea how can I fix this problem?

dependencies error when add firebase libraries

When add firebase in
dependencies
implementation 'com.google.firebase:firebase-core:16.0.6'
Or
implementation 'com.google.firebase:firebase-ads:17.1.2'
Or
implementation 'com.google.android.gms:play-services-ads:17.1.1
It shows error under implementation 'com.android.support:appcompat-v7:28.0.0' that All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).
When I sync the app no error but when install the app it shows you app has been stopped (Crashing during run time).
When remove the firebase dependencies and run, my app it's working fine.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design: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.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-ads:17.1.2'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
}
apply plugin: 'com.google.gms.google-services'
When you include dependencies, they too, will sometimes include dependencies of their own. Some of the firebase libraries happen to include support libraries at a lower version than 28. When you hover over the error message for appcompat-v7 it should tell you what library is lower than 28. You may have to click 'show more' on the error message. Once you figure out which one it is, include that exact same library but version 28. Resync your gradle and you're good to go. Also, you might have to do this multiple times because some firebase libraries include multiple lower version support libraries and the error message will only show you one library at a time.

libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-alpha1, 26.1.0

ll com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 28.0.0-alpha1, 26.1.0. Examples include
com.android.support:animated-vector-drawable:28.0.0-alpha1 and
com.android.support:customtabs:26.1.0 less... (Ctrl+F1) There are
some combinations of libraries, or tools and libraries, that are
incompatible, or can lead to bugs. One such incompatibility is
compiling with a version of the Android support libraries that is not
the latest version (or in particular, a version lower than your
targetSdkVersion).
my gradle dependencies:-
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
warning on this dependencies -----------------------------
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
testImplementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
implementation 'com.memetix:microsoft-translator-java-api:0.6.2'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.facebook.android:audience-network-sdk:4.+'
>
Something's using older library and The culprit is firebase-core:16~;
After quite some trials I resolved this issue.
From this answere and this answer I solved the error.
You need to manually add dependencies that are conflicting. (To find conflicting dependencies an easy way is to hover over highlighted errors.)
You can either downgrade your appcompat library to the given/hinted one which is not recommended or manually declare those dependicies.
I Used this code with all updated libraries today and solved errors:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
//this thing is carusing error, to solve - see hints and manually add them.
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.android.support:support-media-compat:28.0.0-rc01'
implementation 'com.android.support:support-v4:28.0.0-rc01'
//implementation 'com.android.support:appcompat-v7:25.2.0'
/*implementation ("com.google.firebase:firebase-core:16.0.1"){
exclude group: 'com.android.support'
}
*/
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'
}
Such behavior makes new developers head scratch.
If this solves your problem please let others know too.
Happy coding.
Update.
Note: Don't forget to check if there's other libraries added to your project causing warning.
Proof of its working.
Use this dependencie
implementation 'com.android.support:appcompat-v7:27.1.1'
This is caused because your image cropper library contains older version of support library. Use this on your Image Cropper library:
implementation ("com.theartofdev.edmodo:android-image-cropper:2.3.+"){
exclude group: 'com.android.support'
}
This will remove your gradle issue .
Use this dependencies below
implementation 'com.android.support:support-v4:28.0.0'
implementation ("com.theartofdev.edmodo:android-image-cropper:2.3.+"){
exclude group: 'com.android.support'
}
nitinkumarp gives working advice. Perhaps the conflict has several dependencies. You need to check each one, remove all dependencies and add and synchronize one by one until a warning appears. This will be the dependency that causes the warning.

Android Studio 3.1.4 implementation 'com.android.support:appcompat-v7:28.0.0-rc01' error

is there any fix to this error?
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
Error Log:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-rc01, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-rc01 and com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).
what does it need me to do?
Here is my gradle file:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
compile 'com.google.firebase:firebase-core:16.0.0'
Just follow the instructions and the error will be gone. Add the following dependencies to the gradle file because you must have to use the same version of library in your project for smooth operation of app.
implementation 'com.android.support:animated-vector-drawable:28.0.0-rc01'
implementation 'com.android.support:support-media-compat:28.0.0-rc01'
Actually android studio provides all the information (errors and warning) to ease the development.
And also a suggestion change the compile to implementation in the firebase-core library

Categories

Resources