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

时间:2018-09-03 14:37:46

标签: android

所以我最近将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'

我应该做些什么改变才能停止收到此错误消息?

1 个答案:

答案 0 :(得分:0)

只是建议

我建议您暂时使用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'
}