farzaneh___
farzaneh___

Reputation: 127

All com.android.support libraries must use the exact same version specification . Found versions 27.0.2, 25.1.0, 25.0.0 in android studio 2.3

I have one error in gradle file for compile 'com.android.support:appcompat-v7:27.0.2'.

gradle version is 2.3.0

I searched a lot ,but could not solve this problem. my error is:

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.1.0, 25.0.0. Examples include com.android.support:animated-vector-drawable:27.0.2 and com.android.support:design:25.1.0

app/build.gradle:

android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig {
    applicationId "com.example.pegah_system.sanduqchehproject"
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
}
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.squareup.retrofit2:retrofit:2.0.0-beta4') {   
    exclude module: 'okhttp'
}
compile 'com.github.bumptech.glide:glide:3.8.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
compile 'com.github.ybq:Endless-RecyclerView:1.0.3'
compile 'com.github.ybq:Android-SpinKit:1.1.0'
compile 'com.github.qdxxxx:BezierViewPager:v1.0.5'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.roughike:bottom-bar:2.1.2'
compile 'com.squareup.okhttp3:okhttp:3.0.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:support-v4:27.0.2'
testCompile 'junit:junit:4.12'
}

Upvotes: 0

Views: 577

Answers (2)

ישו אוהב אותך
ישו אוהב אותך

Reputation: 29783

The problem is because there are conflicted dependencies in your project. You're using some libraries which implicitly using support library 27.0.2, 25.1.0, and 25.0.0.

The following libraries is using a different support library than 27.0.2:

compile 'com.github.qdxxxx:BezierViewPager:v1.0.5'
compile 'com.roughike:bottom-bar:2.1.2'

BezierViewPager is using support library inside its build.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'
    })
    compile 'com.android.support:appcompat-v7:25.0.0'
    testCompile 'junit:junit:4.12'


    compile 'com.android.support:cardview-v7:25.0.0'
    compile 'com.github.bumptech.glide:glide:3.6.1'
}

bottom-bar library is using support library 25.0.2 in its build.gradle and library build.gradle:

ext {
    compileSdkVersion = 25
    buildToolsVersion = "25.0.2"
    minSdkVersion = 11
    targetSdkVersion = 25
    supportLibraryVersion = "25.3.0"

    junitVersion = "4.12"
}

So, you need to exclude the support library from them. You can do it with this:

  compile ("com.github.qdxxxx:BezierViewPager:v1.0.5") {
    exclude group: 'com.android.support'
    exclude module: 'appcompat-v7'
    exclude module: 'cardview-v7'
  }

  compile ("com.roughike:bottom-bar:2.1.2") {
    exclude group: 'com.android.support'
    exclude module: 'appcompat-v7'
    exclude module: 'design'
  }

You can check the dependencies tree if you still found the conflicted libraries with:

./gradlew app:dependencies

Upvotes: 1

Micer
Micer

Reputation: 8969

Try to check your dependencies in dependency tree, you can show it with this command in terminal:

./gradlew app:dependencies

app is your module

There you can find examples mentioned in error message com.android.support:animated-vector-drawable:27.0.2 and com.android.support:design:25.1.0 and check their versions.

What I usually do when I run into such issues with dependencies is I try to remove them one by one to see where the conflict comes from.

Upvotes: 1

Related Questions