android - 不兼容的 gradle 依赖项

标签 android android-gradle-plugin

我在我的应用程序的 android 库的 build.gradle 文件中看到一条错误消息。依赖 block 如下所示:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'com.android.support:recyclerview-v7:27.0.2'
    compile 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'
}

我看到的消息是:

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

显然,版本 27.0.2 和 21.0.3

Found versions 27.0.2, 21.0.3. Examples include com.android.support:animated-vector-drawable:27.0.2 and com.android.support:support-v4:21.0.3 less... (⌘F1)

最佳答案

覆盖旧的库

 dependencies {
            implementation fileTree(dir: 'libs', include: ['*.jar'])
            implementation 'com.android.support:appcompat-v7:27.0.2'
            testImplementation 'junit:junit:4.12'
            androidTestImplementation 'com.android.support.test:runner:1.0.1'
            androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
            compile 'de.hdodenhof:circleimageview:2.2.0'
            compile 'com.android.support:recyclerview-v7:27.0.2'
            compile 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'
            //overwrite old LIB
            compile 'com.android.support:support-v4:27.0.2'  

        }

关于android - 不兼容的 gradle 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48593699/

相关文章:

android - 在哪里放置 uiautomator 测试

android - 找不到模块 'which' - Cordova android

Android adb命令用于触发自定义接收器

java - app:dexDebug ExecException完成,退出值非零2

android - 编译时 build.gradle 错误 'com.firebase:firebase-client-android:2.5.0'

android - 如何更改回收站 View 中项目的位置

android - Android SDK无法解决Twilio依赖关系

android - Gradle 多项目、多个根项目和依赖项

android - 在远程 adb 服务器上运行测试

java - 基于 Jenkins 的 Gradle 构建失败