Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

All com.android.support libraries must use the exact same version specification : 27.0.2

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'
}
like image 560
Chawkii Avatar asked Dec 14 '17 13:12

Chawkii


2 Answers

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.

like image 125
Chawkii Avatar answered Nov 19 '22 09:11

Chawkii


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

like image 2
Ergin Ersoy Avatar answered Nov 19 '22 09:11

Ergin Ersoy