清单合并失败的Android Studio

时间:2019-06-17 10:39:10

标签: android-studio

我在build.gradle(module:app)中有这个

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint- 
                    layout:1.1.3'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-database:16.0.4'
                    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:gridlayout-v7:28.0.0'
}

,当我尝试同步时会显示以下内容:

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

什么会导致此问题以及如何解决?

(将manifests:replace =“ android:appComponentFactory”添加到清单不起作用)

1 个答案:

答案 0 :(得分:1)

您的android-image-cropper库正在使用androidx,而您尚未迁移。强烈建议migrate to using Androidx,因为大多数库都这样做,并且可能不向后兼容com.android.support变体。

如果短期内无法迁移,则可以还原到该库的较低版本。根据{{​​3}},它们已在2.8.0迁移到AndroidX,因此您应该回到2.7.0