Android 支持库必须使用完全相同的版本

标签 android

请问这段 gradle 代码有什么问题,我该如何修复它?

enter image description here

我认为这是一个支持库版本不兼容的问题,但我不知道如何修复它。

下面是应用程序 build.grade 文件的完整内容。

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-crash'

android {
    signingConfigs {
        config_release {
            keyAlias 'xx'
            keyPassword 'xx'
            storeFile file('xx')
            storePassword 'xx'
        }
    }
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "xx"
        minSdkVersion 15
        targetSdkVersion 27

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config_release
            minifyEnabled true
        }
    }

    flavorDimensions "tier"

    productFlavors {
        pay {
            applicationId 'xx'
            versionCode 1
            versionName "1.0"
            dimension "tier"
        }
        free {
            applicationId 'xx'
            versionCode 20
            versionName '2.11'
            dimension "tier"
        }
    }
}
dependencies {
    implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.google.android.gms:play-services-plus:15.0.1'
    implementation 'com.google.android.gms:play-services-gcm:15.0.1'
    implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar') {
        transitive = true
    }

    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:support-vector-drawable:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-crash:16.0.1'
    freeImplementation 'com.google.firebase:firebase-ads:15.0.1'
    testImplementation 'junit:junit:4.12'
    implementation 'com.google.android:flexbox:0.3.2'
}

应用插件:“com.google.gms.google-services” 提前致谢。

最佳答案

您必须用较高版本覆盖提示中显示的较低版本的每个库。 (与提示中显示的相同,在您的情况下为 27.1.1)

例如,您在提示中具有 com.android.support:customtabs:26.1.0 :

因此,在依赖项 block 中添加 'com.android.support:support:customtabs:27.1.1' 以及较高版本 27.1.1 而不是 26.1.0:

implementation 'com.android.support:support-media-compat:27.1.1'

然后重复此操作,直到警告消失,之后其他库可能会出现其他警告

关于Android 支持库必须使用完全相同的版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50900152/

相关文章:

java - 访问 setOnTouchListener 中的循环变量

android - 在 android 中启用和禁用日期

java - android SQLite,无法再在我的 listView 中查看数据

android - 为什么我应该使用 PNG 而不是 JPG?

Android MediaStore.Images.Media.insertImage 只有在使用相机应用拍照后才能在 KitKat 上运行

java - Android 房间错误 : Dao class must be annotated with @Dao

android - Firebase Analytics 用户属性

java - 改造自定义回调和未检查的分配

android - 没有相应的 commit() 或 apply() 调用的 SharedPreferences.edit()

android - 在android中插入外部数据库