After updating targetSdkVersion to 27 I got this error message.
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.0.2, 25.2.0. Examples include com.android.support:animated-vector-drawable:27.0.2
and com.android.support:support-media-compat:25.2.0
I understand that I should update com.android.support:support-media-compat
but I dont know how because I am not using it in build.gradle , I tried to update SDK tools but the problem is still remaining . bellow is build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.ex"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
implementation 'com.google.android.gms:play-services-ads:11.6.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.bloder:magic:1.1'
implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
}
I have checked manually the libraries in project -> .myidea-> libraries then I found that I have two libraries using the old version :
com_android_support_support_media_compat_25_2_0
com_android_support_support_v4_25_2_0
then just by adding this line in builde.gradle
implementation 'com.android.support:support-v4:27.0.2'
The error is gone now.
I encountered the exact same problem. You are not using in your build.graddle but some library that you included in your build.graddle is using. Therefore, you need to override them, which are pointed in warning, in your build.graddle
I have gotten this error before. Try clicking build on Android Studio Toolbar.
- Clean Build
- After Step 2, Click Rebuild Project.
Update
If not, try explicitly adding implementation com.android.support:support-media-compat:27.0.2
to the build
What you are dealing with appears to be transitive dependencies. In other words just as you use gradle so you don't have to re-invent the wheel the maker of the dependency you are using also uses dependencies. It appears the problem is with this dependency 'com.github.bloder:magic:1.1' because it depends on 'com.android.support:appcompat-v7:23.1.1'. I found this out by visiting the repository pom description for blogger magic. In android studio I could also have also clicked on the gradle tab on the right and found one of the dependency task and found the conflict this way. Now that we know the problem excluding a transitive dependency may help checking to see if all dependencies are up to date may help or not using blogger magic at all may help. This problem is difficult, I know. Just hope this helps.
I encountered similar problem when updated the gradle. I implicitly declared the error written support library. I had to perform this implicitly for 3 more support libraries. This error does not solve by implicitily declaring a support library. If u want to solve the problem immediately, then replace all 27.0.2 to 25.2.0 in com.android.support.* libraries.
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"
Please refer this to see the original answer
https://stackoverflow.com/a/49169228/4156595