Dennis
Dennis

Reputation: 37

"All com.android.support libraries must use the exact same version specification" when compiling android.support:appcompat-v7:25.2.0

After updating Android Studio to Version 3.1.2 I'm getting an error in my app's build.gradle:

All com.android.support libraries must use the exact same version specification (...). Found versions 28.0.0-alpha1, 26.1.0. Examples include com.android.support:asynclayoutinflater:28.0.0-alpha1 and com.android.support:animated-vector-drawable:26.1.0

This is my gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "org.hopto.****.musicplayer"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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'
    })
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.cleveroad:audiowidget:0.9.0'
    compile 'com.google.android.gms:play-services-ads:10.2.0'
    compile 'com.android.support:recyclerview-v7:+'
    testCompile 'junit:junit:4.12'
}

I've tried solving this by adding the following lines:

compile 'com.android.support:asynclayoutinflater:25.0.0'
compile 'com.android.support:animated-vector-drawable:25.0.0'

I've also tried this with different version, eg 25.2.0 and 25+, but none of this worked.

Upvotes: 1

Views: 1073

Answers (1)

Michail Ai
Michail Ai

Reputation: 41

You are using the following support libraries:

compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:recyclerview-v7:+' //error here

As you can see, your recyclerview library is using '+' which is the latest version available, that is 28.0.0-alpha1 or 26.1.0 (stable). For the rest you are using 25.2.0, thus the error with the version mismatch.

The solution is to either change recyclerview version to 25.2.0 or everything to 26.1.0 (including the recyclerview).

Side note: you should avoid using '+' in version numbers as you may come up with unexpected behavior when your libraries update.

Upvotes: 1

Related Questions