请问这段 gradle 代码有什么问题,我该如何修复它?
我认为这是一个支持库版本不兼容的问题,但我不知道如何修复它。
下面是应用程序 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/