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

所有com.android.support库必须使用与firebase完全相同的版本规范,android,Android,所以我最近在gradle中添加了firebase数据库依赖项,我在同步后收到了这条消息 '所有com.android.support库必须使用相同的确切版本 规范(混合版本可能导致运行时崩溃)。建立 版本28.0.0-rc02、26.1.0。例子包括 支持:动画矢量绘图:28.0.0-rc02和 com.android.support:support-v4:26.1.0' 我的gradle文件: apply plugin: 'com.android.application' android {

所以我最近在gradle中添加了firebase数据库依赖项,我在同步后收到了这条消息

'所有com.android.support库必须使用相同的确切版本 规范(混合版本可能导致运行时崩溃)。建立 版本28.0.0-rc02、26.1.0。例子包括 支持:动画矢量绘图: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'
}

它无法同步,并给我错误消息
,请通过更新google服务插件的版本来修复版本冲突(有关最新版本的信息,请访问https://bintray.com/android/android-tools/com.google.gms.google-services/)或者将com.google.android.gms的版本更新为16.0.3。
并在27.1.1的所有内容上画一条红线,它无法同步,并给出此错误消息
模块“app”:未找到平台“android-27”。
未找到,因为您尚未更新该版本的sdk。转到sdk管理器下载并安装API 27。哪一个安卓8.1(Oreo)API级别为27,请参见我的更新答案。我删除了buildToolsVersion。