简体   繁体   English

android支持库中的版本冲突

[英]Version conflict in android support library

I have this in build.gradle file. 我在build.gradle文件中有这个。 All the support library version is set to 25.3.1. 所有支持库版本均设置为25.3.1。 Still the Android studio shows error : Android Studio仍然显示错误:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). 所有com.android.support库都必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。 Found versions 26.1.0, 25.3.1, 23.4.0. 找到版本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. 例子包括com.android.support:customtabs:26.1.0和com.android.support:animated-vector-drawable:25.3.1 less ...(Ctrl + F1)有一些库,工具和库的组合,不兼容或可能导致错误的代码。 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). 一种不兼容的情况是使用不是最新版本的Android支持库版本进行编译(或者特别是低于目标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' . 该错误是由于库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. 检查相应库的app.gradle

You can rectify this by using reducing your target version and compiled version to 23 and changing the support libraries to 23.2.0. 您可以通过将目标版本和编译版本降低为23并将支持库更改为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) 或者尝试使用https://github.com/kizitonwose/colorpreference (可以是类似的库)并将项目更新到27.1.0。(不确定)

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. 播放服务广告15.0.0使用26.1.0进行编译,可能会导致显示此警告。 Try the same with 10.2.1 尝试与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. 可能是由于您的一个库在内部使用com.android.support:animated-vector-drawable:25.3.1com.android.support:customtabs:26.1.0 ,因此您需要单独指定它们具有相同的版本。 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. 由于与Glide库发生冲突,我遇到了同样的问题。 Because you don't have many dependencies you can experiment and try to delete some (third party dependencies) and see if the error persists. 由于您没有太多依赖关系,因此您可以尝试并尝试删除一些(第三方依赖关系)并查看错误是否仍然存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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