简体   繁体   中英

Version conflict in android support library

I have this in build.gradle file. All the support library version is set to 25.3.1. Still the Android studio shows error :

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 26.1.0, 25.3.1, 23.4.0. Examples include com.android.support:customtabs:26.1.0 and com.android.support:animated-vector-drawable:25.3.1 less... (Ctrl+F1) There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "com.jeyom.boxthought"
        minSdkVersion 19
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:support-v4:25.3.1'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:25.3.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:cardview-v7:25.3.+'
    implementation 'com.android.support:recyclerview-v7:25.3.+'
    implementation 'com.android.support:design:25.3.1'
    implementation 'com.thebluealliance:spectrum:0.7.1'
    implementation 'com.google.android.gms:play-services-ads:15.0.0'
    testImplementation 'junit:junit:4.12'
}

The Error is Due to the app.gradle in the Library implementation 'com.thebluealliance:spectrum:0.7.1' . This error can be caused by dependencies used by the developer and also clash between the dependencies in 3rd party libraries

They are using the following dependencies

compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:preference-v7:23.4.0'
compile 'com.android.support:support-annotations:23.4.0'
compile 'org.greenrobot:eventbus:3.0.0'

Check the app.gradle of the corresponding library.

You can rectify this by using reducing your target version and compiled version to 23 and changing the support libraries to 23.2.0.

OR try using https://github.com/kizitonwose/colorpreference which can be a similar library and update project to 27.1.0.(Not sure)

Or Simply ignore this warning.

Second Cause may Be

plays service ads 15.0.0 is compiled with 26.1.0 it may lead to show this warning. Try the same with 10.2.1

This answer explains it really well. It may be due to the fact that one of your libraries is internally using com.android.support:animated-vector-drawable:25.3.1 and com.android.support:customtabs:26.1.0 , so you need to specify them separately with the same version. As far as I know you also need to make sure that the compile version is higher (which it is, but just in case). I had the same issue becuase of a conflict with Glide library. Because you don't have many dependencies you can experiment and try to delete some (third party dependencies) and see if the error persists.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM