添加firebase库时如何修复com.android.support库版本错误

添加firebase库时如何修复com.android.support库版本错误,android,firebase,Android,Firebase,当我尝试按照firebase的指示插入库,并尝试同步项目时,出现以下错误: 此支持库不应使用与CompileSDK版本27更少版本26不同的版本。。。Ctrl+F1 检查信息:有些库、工具和库的组合不兼容,或者可能导致错误。其中一个不兼容之处是编译时使用的Android支持库版本不是最新版本,尤其是低于targetSdkVersion的版本 我试图遵循一些指南和过去对这个问题的答案,但错误依然存在 dependencies { implementation fileTree(dir: '

当我尝试按照firebase的指示插入库,并尝试同步项目时,出现以下错误:

此支持库不应使用与CompileSDK版本27更少版本26不同的版本。。。Ctrl+F1 检查信息:有些库、工具和库的组合不兼容,或者可能导致错误。其中一个不兼容之处是编译时使用的Android支持库版本不是最新版本,尤其是低于targetSdkVersion的版本

我试图遵循一些指南和过去对这个问题的答案,但错误依然存在

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-auth:16.2.1'
    implementation 'com.google.firebase:firebase-database:16.1.0'
    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'
更新:

implementation 'com.android.support:support-media-compat:26.1.0'
对下列事项:

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

因此,它可以是与appcompat-v7相同的版本。请确保您在应用程序build.gradle中使用相同的API级别27,用于27.1.1 android支持:

更新

这可能是由于与firebase版本冲突造成的。看这个。 尝试在依赖项上添加此实现,以修复此冲突:

def android_api = "27.1.1"
implementation "com.android.support:appcompat-v7:$android_api"

implementation "com.android.support:animated-vector-drawable:$android_api"
implementation "com.android.support:exifinterface:$android_api"
implementation "com.android.support:cardview-v7:$android_api"
implementation "com.android.support:customtabs:$android_api"
implementation "com.android.support:support-media-compat:$android_api"
implementation "com.android.support:support-v4:$android_api"

只需执行alt+enter并修复它。。如果没有,请给出build.gradlapp.mable duplicate的完整视图,可能的重复,可能的重复15次,它不起作用…默认情况下,我有23分钟的版本23Ok,该错误已消失,但现在它给了我:在BuildingSource style/Theme.AppCompat.Light.DarkActionBar aka com.example.GestionalTorneo:style/Theme.AppCompat.Light.DarkActionBar期间链接引用失败。抱歉,可能我不清楚,因为我说需要添加此实现。但是,您需要保留com.android.support的实现:appcompat-v7:$android\u api。我会再次更新我的答案。非常感谢您的帮助,现在冲突已经消失是的,我不知道为什么通过查看前面的问题它不起作用。如果同步,您可能会再次出现错误,但使用不同的库,那么您只需将库的版本更改为27.1.1
def android_api = "27.1.1"
implementation "com.android.support:appcompat-v7:$android_api"

implementation "com.android.support:animated-vector-drawable:$android_api"
implementation "com.android.support:exifinterface:$android_api"
implementation "com.android.support:cardview-v7:$android_api"
implementation "com.android.support:customtabs:$android_api"
implementation "com.android.support:support-media-compat:$android_api"
implementation "com.android.support:support-v4:$android_api"