所以,我刚刚创建了一个新项目,在添加任何新库或任何内容之前,我刚刚添加了 firebase 库,一旦我同步了 gradle,它就会给我一个错误,说混合 android 库可能会导致 appcompat 出现问题图书馆。
我在这里做错了什么?为什么我会收到此错误以及如何消除它?
这是我的 gradle 文件的源代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.femindharamshi.codifyadmin"
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'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
implementation 'com.google.firebase:firebase-core:16.0.4'
}
apply plugin: 'com.google.gms.google-services'
最佳答案
您可以看到this answer 。只需要这样做:
implementation ('com.google.firebase:firebase-core:16.0.4') {
exclude group: "com.android.support"
}
关于android - 添加 firebase 时 Gradle 出现兼容性错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53028495/