【问题标题】:Firebase incompatible with appcompatFirebase 与 appcompat 不兼容
【发布时间】:2019-07-21 12:54:13
【问题描述】:

我刚刚更新了 gradle 依赖项,现在出现编译错误,我不知道如何管理。

这是我的 gradle 依赖项:

dependencies {
    implementation "android.arch.work:work-runtime:1.0.1"
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'com.google.android.gms:play-services-plus:17.0.0'
    implementation 'com.google.android.gms:play-services-places:17.0.0'


    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.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'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

Firebase 和 play-service 似乎与 appcompat 不兼容,但我不知道如何处理。

我得到的错误是:

Manifest merger failed : Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.

按照建议将'tools:replace="android:appComponentFactory" 添加到清单中会使事情变得更糟。

Appcompat 在工具提示中显示此消息: Dependencies using groupId com.android.support and androidx.* can not be combined but found IdeMavenCoordinates{myGroupId='com.android.support', myArtifactId='viewpager', myVersion='28.0.0', myPacking='aar', myClassifier='null'} and IdeMavenCoordinates{myGroupId='androidx.interpolator', myArtifactId='interpolator', myVersion='1.0.0', myPacking='aar', myClassifier='null'} incompatible dependencies less... (⌘F1) Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

我需要一个关于如何修复 gradle 依赖项的建议。

【问题讨论】:

标签: android firebase google-play-services


【解决方案1】:

您必须在 gradle.properties 文件中添加两行:

android.useAndroidX=true
android.enableJetifier=true

这两行解决了 google 文件与其他第三方依赖项之间存在冲突的依赖项。

尝试升级您当前的所有依赖项。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-07-04
    • 1970-01-01
    • 2021-04-18
    • 1970-01-01
    • 1970-01-01
    • 2020-04-08
    • 1970-01-01
    相关资源
    最近更新 更多