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

前端 未结 30 2148
忘掉有多难
忘掉有多难 2020-11-21 05:10

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.andr

相关标签:
30条回答
  • 2020-11-21 05:55

    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.

    0 讨论(0)
  • 2020-11-21 05:56

    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'
    
    0 讨论(0)
  • 2020-11-21 05:56

    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'
    
    0 讨论(0)
  • 2020-11-21 05:56

    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

    0 讨论(0)
  • 2020-11-21 05:57

    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 :)

    0 讨论(0)
  • 2020-11-21 05:58

    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

    0 讨论(0)
提交回复
热议问题