【发布时间】:2019-10-01 11:37:44
【问题描述】:
我在没有使用 androidx 的项目中添加了 MaterialAlertDialog。这会在下一次构建期间导致错误。所以我从应用程序级别的构建 gradle 中删除了“实现”语句。但是当我尝试构建我的项目时,我仍然遇到明显的合并错误。
这是我在构建时遇到的错误
清单合并失败:属性 application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 也存在于 [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory)。 建议:将 'tools:replace="android:appComponentFactory"' 添加到 AndroidManifest.xml:19:5-152:19 的元素以覆盖。
到目前为止,我已经尝试了以下解决方案,关闭并重新加载我的项目。清理并重建。删除我项目中的 .gradle 和 .idea 文件夹并重新构建它
这些是我项目中的依赖项
dependencies
{
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "com.android.support:appcompat-v7:${android_support_version}"
implementation "com.android.support:design:${android_support_version}"
implementation 'com.github.lzyzsd:circleprogress:1.1.0@aar'
implementation 'com.github.JakeWharton:ViewPagerIndicator:2.4.1@aar'
implementation 'commons-net:commons-net:3.3'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
transitive = true
}
implementation "de.hdodenhof:circleimageview:${circle_imageview}"
implementation "com.github.bumptech.glide:glide:${glide_version}"
implementation "com.android.support:recyclerview-v7:${android_support_version}"
implementation "com.android.support:cardview-v7:${android_support_version}"
implementation "com.squareup.retrofit2:retrofit:${retrofit_service_version}"
implementation "com.squareup.retrofit2:converter-gson:${retrofit_gson_convertor}"
implementation "com.clough.android.androiddbviewer:androiddbviewer:${dbviewer_version}"
implementation "com.android.support:multidex:${multidex_version}"
implementation "com.github.crosswall:Android-Coverflow:${viewPager_version}"
implementation "com.squareup.okhttp3:logging-interceptor:3.4.0"
implementation project(':sdkui')
implementation 'com.github.ronaldsmartin:Material-ViewPagerIndicator:1.0.4'
implementation 'com.google.android.gms:play-services-base:16.0.1'
implementation 'com.google.android.gms:play-services-identity:16.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-auth-api-phone:16.0.0'
implementation 'com.google.firebase:firebase-config:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
}
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
-
您正在使用需要 androidx 迁移的 firebase 库。
-
您是否尝试过:在 Android Studio 上清理和重建?
-
@Gabriele Mariotti 我的项目运行良好,直到我尝试为 MaterialAlertDialog 添加依赖项。所以我不确定firebase是否会导致这个问题。
-
@DeepakJanardhanan 此外,材料组件库需要androidx libraries。
-
@GabrieleMariotti 你说的是正确的。是 Firebase 导致了这个问题。我把它降到 17.3.4 并且构建成功了。
标签: android android-manifest androidx