After updating to android studio 2.3 I got this error message. I know it's just a hint as the app run normally but it's really strange.
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.1.1, 24.0.0. Examples include com.android.support:animated-vector-drawable:25.1.1 and com.android.support:mediarouter-v7:24.0.0
my gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:support-v4:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.android.support:recyclerview-v7:25.1.1'
compile 'com.android.support:cardview-v7:25.1.1'
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.blankj:utilcode:1.3.6'
compile 'com.orhanobut:logger:1.15'
compile 'com.facebook.stetho:stetho:1.4.2'
provided 'com.google.auto.value:auto-value:1.2'
annotationProcessor 'com.google.auto.value:auto-value:1.2'
annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'
compile 'com.mikepenz:iconics-core:2.8.2@aar'
compile('com.mikepenz:materialdrawer:5.8.1@aar') { transitive = true }
compile 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar'
compile 'me.zhanghai.android.materialprogressbar:library:1.3.0'
compile 'com.github.GrenderG:Toasty:1.1.1'
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.8.0'
compile 'com.github.MAXDeliveryNG:slideview:1.0.0'
compile 'com.facebook.fresco:fresco:1.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.maps.android:android-maps-utils:0.4.4'
compile 'com.github.jd-alexander:library:1.1.0'
}
This question is related to
android
build.gradle
I have the same Problem but I solved this By adding those Three Lines
implementation 'com.android.support:design:27.1.1'
implementation "com.android.support:customtabs:27.1.1"
implementation 'com.android.support:mediarouter-v7:27.1.1'
now Every thing Works perfectly
I have faced this problem after upgrading to android studio 3.4 and sdk version to 28.0.0. Applying below dependency solved the problem for me.
implementation 'com.android.support:exifinterface:28.0.0'
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.1.1, 24.0.0. Examples include com.android.support:animated-vector-drawable:25.1.1 and com.android.support:mediarouter-v7:24.0.0
This warning usually happens when we're using Google Play Services because it's using support libraries as dependencies.
Most of us didn't know that we can override the support libraries used in Google Play Services. When we using the following dependency:
implementation "com.android.support:animated-vector-drawable:25.1.1"
it implicitly depends on com.android.support:mediarouter-v7:25.1.1
. But it is clashed with Google Play Service dependency which is com.android.support:mediarouter-v7:24.0.0
. So, we need to override it by explicitly using the library with:
implementation "com.android.support:mediarouter-v7:25.1.1"
Then, your dependencies block will includes both of them like this:
dependencies {
implementation "com.android.support:animated-vector-drawable:25.1.1"
implementation "com.android.support:mediarouter-v7:25.1.1"
...
}
Highlight the error and press "ALT+ENTER", you'll see an option to:
Add Library dependency > Edit Intention settings
This will bring you to a menu where you'll see the specific problem support dependency that differs with support-compat. Create its dependency in gradle (com 'XXX') and set it's version to match that of support-compat. Sync gradle and you're done.
It just simple just force all v7 and v4 libraries to use the library version you have set just before your dependencies.
configurations.all {
// To resolve the conflict for com.android.databinding
// dependency on support-v4:21.0.3
resolutionStrategy.force 'com.android.support:support-v4:28.0.0'
resolutionStrategy.force 'com.android.support:support-v7:28.0.0'
}
Open the external library of your project you will see that some library still using previous version although you didn't mention those library so my suggestion is just use the particular library version for those it will solve your problem.
Use support-v13 instead of support-v4
compile 'com.android.support:support-v13:25.2.0'
I had to add the following lines in gradle to remove the error this depends on the version you are using same as appcompat
compile 'com.android.support:appcompat-v7:26+'
compile 'com.android.support:mediarouter-v7:26+'
just add this :
compile 'com.android.support:mediarouter-v7:25.2.0'
Updated
for new SDK versions
compile 'com.android.support:mediarouter-v7:28.0.0-alpha3'
As you already seen the all answers and comments above but this answer is to clear something which a new developer might not get easily.
./gradlew -q dependencies app:dependencies --configuration compile
The above line will save your life with no doubt but how to get the exact point from the result of above line.
When you get the all dependency chart or list from the above command then you have to search the conflicting version number which you are getting in your code. please see the below image.
in the above image you can see that 23.4.0 is creating the problem but this we not able to find in our gradle file. So now this version number(23.4.0) will save us. When we have this number then we will find this number in the result of above command result and directly import that dependency directly in our gradle file. Please see the below image to get the clear view.
you can clearly see that com.android.support:cardview-v7:23.4.0 and com.android.support:customtabs:23.4.0 are using the version which is creating the problem. Now just simply copy those line from dependency list and explicitly use in our gradle file but with the updated version link
implementation "com.android.support:cardview-v7:26.1.0" implementation "com.android.support:customtabs:26.1.0"
Another thing that could cause this issue, is if you got declarations like this:
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:+'
That +
means taking the latest version which might be a later version than the 25.3.1
. Replace the +
with the specific version like 25.3.1
like this:
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
and it will solve the issue
I had the same problem before and I got the solution for it.
I just added the libraries that had the another version but with the same version of my support:appcompat
.
For your error for example :
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.1.1, 24.0.0. Examples include com.android.support:animated-vector-drawable:25.1.1 and com.android.support:mediarouter-v7:24.0.0
*The solution is to compile the versions of these libraries like that :
compile 'com.android.support:mediarouter-v7:25.1.1'
-if another library had the same issue and had another version just compile it with your support:appcompat
version
This resolved my problem and I hope it resolves yours.
Best wishes :)
I used these two to solve my problem after upgrading to android studio 2.3
compile 'com.android.support:animated-vector-drawable:25.0.0'
compile 'com.android.support:mediarouter-v7:25.0.0'
Had the same issue after updating to Android Studio 2.3, the fix was to add the following package in the build.gradle
:
compile 'com.android.support:support-v13:25.3.1'
Note: Change the version to match other support library packages used in your project
If the same error is on appcompat
implementation 'com.android.support:appcompat-v7:27.0.1'
then adding design
solved it.
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support:design:27.0.1'
For me, adding
implementation 'de.mrmaffen:vlc-android-sdk:2.0.6'
was including appcompat-v7:23.1.1
in
.idea/libraries
without vlc
, appcompat
alone is enough.
Another way to solve conflicts is just to force the correct version for all dependencies like this:
dependencies {
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.android.support' && details.requested.name == 'support-v4') {
details.useVersion "27.0.2"
}
}
...
}
https://docs.gradle.org/current/userguide/customizing_dependency_resolution_behavior.html
I had the exact same problem after updating to Android Studio 2.3
Adding this line to dependencies solved my problem:
compile 'com.android.support:customtabs:25.2.0'
I just update my Android Support Repository to (revision: 44.0.0); then Android SDK tools and Emulator to latest version 25.3.1 from sdk manager> SDK tools And it solved my problem.
My problem is solved
add following latest dependencyimplementation 'com.google.firebase:firebase-auth:16.0.4'
Try To make the build tools exactly the same version of support library
example
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.itechnologyeg.*******"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dependencies {
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:animated-vector-drawable:25.0.0'
compile 'com.android.support:mediarouter-v7:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
}
Just copy the version that is less than the current version and add it explicitly with same version number as current version.
Example
Found versions 27.1.1, 27.1.0. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:exifinterface:27.1.0
Just copy the version com.android.support:exifinterface:27.1.0
and change it to com.android.support:exifinterface:27.1.1
so that it becomes equal to the current version you are using and add it to your gradle dependencies as following.
implementation 'com.android.support:exifinterface:27.1.1'
Note: Once you are done don't forget to click Sync now at the top of the editor.
I managed to compile (not very clean) by adding
in 2018 update for this error add implementation from project structure
implementation 'com.android.support:support-v13:28.0.0'
in project mode --> External Libraries there you can find your problem, in my case
i am using version 28 and external libraries i found
com.android.support:support-media-compat-26.0.0
and here was the error.
after implementation support v13
and it's working
I ran ./gradlew tasks --all and checked for dependencies that were a different version from the targeted version (25.3.1). You'll get something like this:
app:prepareComAndroidSupportAnimatedVectorDrawable2531Library - Prepare com.android.support:animated-vector-drawable:25.3.1
app:prepareComAndroidSupportAppcompatV72531Library - Prepare com.android.support:appcompat-v7:25.3.1
app:prepareComAndroidSupportCardviewV72531Library - Prepare com.android.support:cardview-v7:25.3.1
app:prepareComAndroidSupportCustomtabs2531Library - Prepare com.android.support:customtabs:25.3.1
app:prepareComAndroidSupportDesign2531Library - Prepare com.android.support:design:25.3.1
app:prepareComAndroidSupportMediarouterV72531Library - Prepare com.android.support:mediarouter-v7:25.3.1
app:prepareComAndroidSupportPaletteV72531Library - Prepare com.android.support:palette-v7:25.3.1
app:prepareComAndroidSupportRecyclerviewV72531Library - Prepare com.android.support:recyclerview-v7:25.3.1
app:prepareComAndroidSupportSupportCompat2531Library - Prepare com.android.support:support-compat:25.3.1
app:prepareComAndroidSupportSupportCoreUi2531Library - Prepare com.android.support:support-core-ui:25.3.1
app:prepareComAndroidSupportSupportCoreUtils2531Library - Prepare com.android.support:support-core-utils:25.3.1
app:prepareComAndroidSupportSupportFragment2531Library - Prepare com.android.support:support-fragment:25.3.1
app:prepareComAndroidSupportSupportMediaCompat2531Library - Prepare com.android.support:support-media-compat:25.3.1
app:prepareComAndroidSupportSupportV42531Library - Prepare com.android.support:support-v4:25.3.1
app:prepareComAndroidSupportSupportVectorDrawable2531Library - Prepare com.android.support:support-vector-drawable:25.3.1
app:prepareComAndroidSupportTransition2531Library - Prepare com.android.support:transition:25.3.1
app:prepareComAndroidVolleyVolley100Library - Prepare com.android.volley:volley:1.0.0
app:prepareComCrashlyticsSdkAndroidAnswers1312Library - Prepare com.crashlytics.sdk.android:answers:1.3.12
app:prepareComCrashlyticsSdkAndroidBeta124Library - Prepare com.crashlytics.sdk.android:beta:1.2.4
app:prepareComCrashlyticsSdkAndroidCrashlytics267Library - Prepare com.crashlytics.sdk.android:crashlytics:2.6.7
app:prepareComCrashlyticsSdkAndroidCrashlyticsCore2316Library - Prepare com.crashlytics.sdk.android:crashlytics-core:2.3.16
app:prepareComFacebookAndroidFacebookAndroidSdk4161Library - Prepare com.facebook.android:facebook-android-sdk:4.16.1
app:prepareComGoogleAndroidGmsPlayServicesAnalytics1026Library - Prepare com.google.android.gms:play-services-analytics:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl1026Library - Prepare com.google.android.gms:play-services-analytics-impl:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesAuth1026Library - Prepare com.google.android.gms:play-services-auth:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesAuthBase1026Library - Prepare com.google.android.gms:play-services-auth-base:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesBase1026Library - Prepare com.google.android.gms:play-services-base:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesBasement1026Library - Prepare com.google.android.gms:play-services-basement:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesCast1026Library - Prepare com.google.android.gms:play-services-cast:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesLocation1026Library - Prepare com.google.android.gms:play-services-location:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesMaps1026Library - Prepare com.google.android.gms:play-services-maps:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesTagmanagerV4Impl1026Library - Prepare com.google.android.gms:play-services-tagmanager-v4-impl:10.2.6
app:prepareComGoogleAndroidGmsPlayServicesTasks1026Library - Prepare com.google.android.gms:play-services-tasks:10.2.6
app:prepareComGoogleFirebaseFirebaseAnalytics1026Library - Prepare com.google.firebase:firebase-analytics:10.2.6
app:prepareComGoogleFirebaseFirebaseAnalyticsImpl1026Library - Prepare com.google.firebase:firebase-analytics-impl:10.2.6
app:prepareComGoogleFirebaseFirebaseAppindexing1024Library - Prepare com.google.firebase:firebase-appindexing:10.2.4
app:prepareComGoogleFirebaseFirebaseCommon1026Library - Prepare com.google.firebase:firebase-common:10.2.6
app:prepareComGoogleFirebaseFirebaseCore1026Library - Prepare com.google.firebase:firebase-core:10.2.6
app:prepareComGoogleFirebaseFirebaseIid1026Library - Prepare com.google.firebase:firebase-iid:10.2.6
app:prepareComGoogleFirebaseFirebaseMessaging1026Library - Prepare com.google.firebase:firebase-messaging:10.2.6
app:prepareComMindorksPlaceholderview027Library - Prepare com.mindorks:placeholderview:0.2.7
app:prepareDebugAndroidTestDependencies
app:prepareDebugDependencies
app:prepareDebugUnitTestDependencies
app:prepareInfoHoang8fAndroidSegmented105Library - Prepare info.hoang8f:android-segmented:1.0.5
app:prepareIoFabricSdkAndroidFabric1316Library - Prepare io.fabric.sdk.android:fabric:1.3.16
app:prepareNoNordicsemiAndroidLog211Library - Prepare no.nordicsemi.android:log:2.1.1
app:prepareNoNordicsemiAndroidSupportV18Scanner100Library - Prepare no.nordicsemi.android.support.v18:scanner:1.0.0
In this case, I was targeting 25.3.1, and had some dependencies targeting different versions when I ran this command. The trick is to identify the dependencies in this list that are targeting previous versions, and overriding that by importing the most recent version of the dependency in Gradle.
The problem can be resolved using the following method:
AndroidManifest.xml
file.android:value
attribute in the meta-data
, then this is the place to do that change.build.gradle
file.I had these dependencies in my project:
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.firebase:firebase-database:17.0.0'
implementation 'com.google.firebase:firebase-storage:17.0.0'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation 'com.firebaseui:firebase-ui-storage:0.6.0'
So far nothing seemed wrong, but I got this message:
Found versions 28.0.0, 23.4.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:palette-v7:23.4.
Then I did:
$ ./gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath >> dep.txt
In the file, I searched for the palette and found that it was used by firebase storage:
\--- com.firebaseui:firebase-ui-storage:0.6.0
+--- com.android.support:appcompat-v7:23.4.0 -> 28.0.0 (*)
+--- com.android.support:palette-v7:23.4.0
After adding:
implementation 'com.android.support:palette-v7:28.0.0'
Seems resolved, and no more error.
//Cheers
After spending about 5 hours, this solution worked for me..
First add this line to your manifest tag if you do not have yet:
xmlns:tools="http://schemas.android.com/tools"
Example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.winanainc"
android:versionCode="3"
android:versionName="1.2"
xmlns:tools="http://schemas.android.com/tools">
Then Add this meta tag inside your application to overwrite you build tools version, in this case for example I choosed the version 25.3.1
<application>
...
..
<meta-data
tools:replace="android:value"
android:name="android.support.VERSION"
android:value="25.3.1" />
</application>
I had to add the following lines in gradle to remove the error
compile 'com.android.support:animated-vector-drawable:25.2.0'
compile 'com.android.support:preference-v7:25.2.0'
compile 'com.android.support:customtabs:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
after this line You have to add new Line in your gradle
implementation 'com.android.support:design:26.1.0'
add these in app level dependencies
implementation 'com.android.support:asynclayoutinflater:28.0.0'
implementation 'com.android.support:exifinterface: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:support-v4:28.0.0'
remplace this
compile 'com.android.support:appcompat-v7:25.2.0'
by this
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
rebuild and good coding
This error because of glide library. Try Picasso or other image libraries
Here is my flow to fix this warning
build.gradle
android {
compileSdkVersion ... // must same version (ex: 26)
...
}
dependencies {
...
compile 'any com.android.support... library' // must same version (ex: 26.0.1)
compile 'any com.android.support... library' // must same version (ex: 26.0.1)
...
compile ('a library B which don't use 'com.android.support...' OR use SAME version of 'com.android.support'){
// do nothing
}
...
compile ('a library C which use DIFFERENT 'com.android.support...' (ex:27.0.1) {
// By default, if use don't do anything here your app will choose the higher com.android.support... for whole project (in this case it is 27.0.1)
// If you want to use 26.0.1 use
exclude group: 'com.android.support', module: '...' (ex module: 'appcompat-v7')
exclude group: 'com.android.support', module: 'another module'
...
// If you want to use 27.0.1 do
Upgrade `compileSdkVersion` and all 'com.android.support' to 27.0.1.
(It may be a good solution because the best practice is always use latest `compileSdkVersion`.
However, use 26 or 27 is base on you for example higher library may have bug)
}
}
To view/verify the dependencies
of all library in your app
Open terminal and run ./gradlew app:dependencies
To view the dependencies
of a specific library in your app follow tutorial here :- How to exclude dependencies of a particular dependency in Gradle
Hope it help
My problem is similar to yours. Here exist an error!
compile 'com.android.support:appcompat-v7:25.3.0'
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.3.0, 24.0.0. Examples include 'com.android.support:animated-vector-drawable:25.3.0' and 'com.android.support:mediarouter-v7:24.0.0'
Seeing this Examples include 'com.android.support:animated-vector-drawable:25.3.0' and 'com.android.support:mediarouter-v7:24.0.0'
the just add these codes in dependencies, make sure that versions are same.
compile 'com.android.support:animated-vector-drawable:25.3.0'
compile 'com.android.support:mediarouter-v7:25.3.0'
You have defined any other dependency to compile with version 24.0.0
instead of 25.1.1
. Please set all dependencies version the same as 25.1.1
.
I had this:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.google.firebase:firebase-firestore:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation'com.facebook.android:facebook-login:[4,5)'
implementation 'com.twitter.sdk.android:twitter:3.1.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'org.jetbrains:annotations-java5:15.0'
implementation project(':vehiclesapi')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
The solutions was easy - the primary dependencies were all correct so the leaves however - any third party dependencies. Removed one by one until found the culprit, and turns out to be facebook! its using version 27.0.2 of the android support libraries. I tried to add the cardview version 27.1.1 but that didn't work eithern the solution was still simple enough.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.google.firebase:firebase-firestore:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation('com.facebook.android:facebook-login:[4,5)'){
// contains com.android.support:v7:27.0.2, included required com.android.support.*:27.1.1 modules
exclude group: 'com.android.support'
}
implementation 'com.android.support:cardview-v7:27.1.1' // to replace facebook sdk's cardview-v7:27.0.2.
implementation 'com.twitter.sdk.android:twitter:3.1.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'org.jetbrains:annotations-java5:15.0'
implementation project(':vehiclesapi')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
If you are facing problem after implementing all below mentioned new libraries. I was facing the above mentioned same problem on this 'com.android.support:appcompat-v7:27.1.0'
compatible verions.
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:mediarouter-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
I just replace this
'com.android.support:appcompat-v7:27.1.0'
to this
'com.android.support:appcompat-v7:27.0.1'
Add this to the very end of your build.gradle (Module:app):
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.1'
}
}
}
}
Make sure that you replace '25.3.1' with the version of the android support library that you want to use for all the dependencies , it should not be lower than your complile sdk version
than re sync gradle
A) Run gradle dependencies
or ./gradlew dependencies
B) Look at your tree and figure out which of your dependencies is specifying a different support library version for a dependency you don't control.
I didn't realize that this warning also displays if the dependency is completely unused directly by your own code. In my case, Facebook specifies some support libs I wasn't using, you can see below most of those dependencies were overridden by my own specification of 25.2.0, denoted by the -> X.X.X (*) symbols. The card view and custom tabs libs weren't overridden by anyone, so I need to ask for 25.2.0 for those ones myself even though I don't use them.
+--- com.facebook.android:facebook-android-sdk:4.17.0
| +--- com.android.support:support-v4:25.0.0 -> 25.2.0 (*)
| +--- com.android.support:appcompat-v7:25.0.0 -> 25.2.0 (*)
| +--- com.android.support:cardview-v7:25.0.0
| | \--- com.android.support:support-annotations:25.0.0 -> 25.2.0
| +--- com.android.support:customtabs:25.0.0
| | +--- com.android.support:support-compat:25.0.0 -> 25.2.0 (*)
| | \--- com.android.support:support-annotations:25.0.0 -> 25.2.0
| \--- com.parse.bolts:bolts-android:1.4.0 (*)
If gradle has already warned you and given you examples...
Examples include com.android.support:animated-vector-drawable:25.1.1 and com.android.support:mediarouter-v7:24.0.0
... it's even easier if you throw in some grep highlighting for the lower version since gradle dependencies
can be quite verbose:
./gradlew dependencies | grep --color -E 'com.android.support:mediarouter-v7|$'
Use variables: Doing something like the following will make it easier for you to ensure that you use the same version with all libraries
dependencies {
ext {
support_library_version = '25.2.0'
google_play_services_version = '10.2.0'
}
//#####################################################################
// Support Library
//#####################################################################
compile "com.android.support:appcompat-v7:${support_library_version}"
compile "com.android.support:palette-v7:${support_library_version}"
compile "com.android.support:design:${support_library_version}"
//#####################################################################
// Google Play Services
//#####################################################################
compile "com.google.android.gms:play-services-auth:${google_play_services_version}"
compile "com.google.android.gms:play-services-ads:${google_play_services_version}"
compile "com.google.android.gms:play-services-analytics:${google_play_services_version}"
//#####################################################################
// Firebase
//#####################################################################
compile "com.google.firebase:firebase-core:${google_play_services_version}"
compile "com.google.firebase:firebase-auth:${google_play_services_version}"
compile "com.google.firebase:firebase-messaging:${google_play_services_version}"
More information on how Google suggests that you handle this versioning can be found in this article: https://developer.android.com/studio/build/index.html#top-level
Pay attention to the little information window that say something about the error, it says the examples that you have to change and add.
In this case:
Found versions 25.1.1, 24.0.0. Examples include com.android.support:animated-vector-drawable:25.1.1 and com.android.support:mediarouter-v7:24.0.0
Your
com.android.support:animated-vector-drawable:25.1.1
is version 25.1.1, and your
com.android.support:mediarouter-v7:24.0.0
is version 24.0.0, so you have to add the mediarouter with the same version:
com.android.support:mediarouter-v7:25.1.1
And do that for every example that the little information window says, in this case all the libraries that doesn't have the version 25.1.1.
You have to sync the gradle after you fix the indicated library to see the next library and package that you have to change.
IMPORTANT:
You also can use another method to see the difference of the versions of all the libraries that you are actually compiling (like run a gradle dependency report or go to your libraries files), the real objetive is compile all the libraries that you are using with the same version.
The best way to solve the problem is implement all 'com.android.support:...' suggested by Android Studio
(Doesn't matter which support versions you are using – 27.1.1, 28.0.0 etc.)
Place the cursor to the error line e.g.
implementation 'com.android.support:appcompat-v7:28.0.0'
Android Studio will suggest you which 'com.android.support:...' is different version than 'com.android.support:appcompat-v7:28.0.0'
Example
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.0, 27.0.2. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:exifinterface:27.1.0
So add com.android.support:animated-vector-drawable:28.0.0
& com.android.support:exifinterface:28.0.0
.
Now sync gradle file.
One by one try to implement all the suggested 'com.android.support:...' until there is no error in this line implementation 'com.android.support:appcompat-v7:28.0.0'
In my case, I added
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
All these dependencies, it could be different for you.
My solution i just add
//noinspection GradleCompatible
and I build to test my app, everything is ok.
After searching and combining answers, 2018 version of this question and it worked for me:
1) On navigation tab change it to project view
2) Navigate to [YourProjectName]/.idea/libraries/
3) Delete all files starting with Gradle__com_android_support_[libraryName]
E.g: Gradle__com_android_support_animated_vector_drawable_26_0_0.xml
4) In your gradle file define a variable and use it to replace version number like ${variableName}
Def variable:
ext {
support_library_version = '28.0.0' //use the version of choice
}
Use variable:
implementation "com.android.support:cardview-v7:${support_library_version}"
example gradle:
dependencies {
ext {
support_library_version = '28.0.0' //use the version of choice
}
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:animated-vector-drawable:${support_library_version}"
implementation "com.android.support:appcompat-v7:${support_library_version}"
implementation "com.android.support:customtabs:${support_library_version}"
implementation "com.android.support:cardview-v7:${support_library_version}"
implementation "com.android.support:support-compat:${support_library_version}"
implementation "com.android.support:support-v4:${support_library_version}"
implementation "com.android.support:support-core-utils:${support_library_version}"
implementation "com.android.support:support-core-ui:${support_library_version}"
implementation "com.android.support:support-fragment:${support_library_version}"
implementation "com.android.support:support-media-compat:${support_library_version}"
implementation "com.android.support:appcompat-v7:${support_library_version}"
implementation "com.android.support:recyclerview-v7:${support_library_version}"
implementation "com.android.support:design:${support_library_version}"
}
I got this problem after updating to Android Studio 2.3
Adding these lines in dependencies solved my problem
compile 'com.android.support:customtabs:25.2.0'
compile 'com.android.support:palette-v7:25.2.0'
For me I resolved error by adding: compile 'com.android.support:design:<version>'
There's only one way...and you have to manually do it... go to build.gradle check assign all dependencies to same versions.. and it should work..
project/.idea/libraries
folder on your file system and see which libraries are different.build.gradle
file.E.g.:
compile 'com.android.support:appcompat-v7:25.2.0'
// Wrong library version found on 1st point
compile 'com.android.support:customtabs:25.2.0'
Make sure all Facebook SDK dependencies use the same support library version of your project:
dependencies {
// Facebook SDK dependencies, excluding Bolts
compile "com.android.support:appcompat-v7:25.4.0"
compile "com.android.support:cardview-v7:25.4.0"
compile "com.android.support:customtabs:25.4.0"
compile "com.android.support:design:25.4.0"
compile "com.facebook.android:facebook-android-sdk:4.23.0"
}
Simply add //noinspection GradleCompatible:
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
OR
Add the following implementation statements to the dependencies section. (If it shows some App Compat library mismatch error, then we have to re-implement all the mismatching support libraries. We can find the mismatching libraries by place the cursor over the error.Press the shortcut key ctrl + F1 for reveal full details in android studio.)
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
For me, the error was a result of a third-party library that I imported that used older Google Support Library modules. I simply updated them to the latest version (checking on Github for example), and the error was gone. I suggest checking all the non-Google libraries that you included in your build.gradle
are up to date.
I got the same error after adding compile 'com.google.android.gms:play-services:10.2.4'
with compile 'com.android.support:appcompat-v7:25.3.1'
.
Adding animated-vector-drawable
and mediarouter libs
fixed the issue.
compile 'com.google.android.gms:play-services:10.2.4'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:animated-vector-drawable:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
Source: Stackoverflow.com