所有 com.android.support 库都必须使用 Firebase 完全相同的版本规范



所以我最近将 Firebase 数据库依赖项添加到我的 gradle 中,并在同步后收到此消息

'所有 com.android.support 库必须使用相同的确切版本 规范(混合版本可能导致运行时崩溃(。发现 版本 28.0.0-RC02、26.1.0。示例包括 com.android.support:animated-vector-drawable:28.0.0-rc02 和 com.android.support:support-v4:26.1.0'

我的 gradle 文件:

apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "..."
minSdkVersion 21
targetSdkVersion 28
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:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support:support-media-compat:28.0.0-rc02'
implementation 'com.android.support:animated-vector-drawable:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'

我应该进行哪些更改才能停止收到此错误消息?

只是一个建议

我建议,现在,你应该使用v7:27而不是v7:28。因为关于这个版本有很多未解决的问题。我也回退到以前的版本,直到它稳定下来,你可以更新它。

所以你可以试试这个:

sdkVersion更改为 27

android {
compileSdkVersion 27
defaultConfig {
targetSdkVersion 27
}

...
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

最新更新