android - (它没有 rc01)清单合并失败:属性 application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory)
问题描述
它说清单合并错误,尽管我的清单实际上是正确的
这是我的应用程序模块 gradle 依赖文件
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
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.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-database:18.0.0'
implementation 'com.firebaseui:firebase-ui-database:0.4.1'
implementation 'com.android.support:recyclerview-v7:28.0.0'
}
apply plugin: 'com.google.gms.google-services'
这是错误
清单合并失败:来自 [com.android.support:support-compat:28.0.0-alpha3] AndroidManifest.xml:22:18-91 的属性 application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) 也是存在于 [androidx.core:core:1.0.0-alpha3] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory)。建议:添加 'tools:replace="android:appComponentFactory"'
解决方案
问题与 AndroidX 库有关。将您的支持库迁移到 AndroidX。在 AndroidStudio 中,您可以使用Refactor > Migrate to AndroidX菜单手动执行此操作。使用 VCS(例如 git)跟踪更改以查看会发生什么。
您也可以通过将 gradle 依赖项更改为:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-database:18.0.0'
implementation 'com.firebaseui:firebase-ui-database:0.4.1'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
然后,找到所有旧的依赖项导入和新的依赖项。
将这些标志放入您的
gradle.properties
可以解决一些相关问题:
android.enableJetifier=true
android.useAndroidX=true
推荐阅读
- android - Android:当我设置 shouldOverUriLoading 返回 false 时,HTML 中的脚本无法调用 addEventListener
- java - 如何从其他方法访问列表?
- php - PHP 中的 Gmail IMAP 适用于本地主机,但不适用于实时域
- angular - Angular Universal 服务:ssr 服务器端渲染生成器
- machine-learning - 如何通过测试我的掩码 rcnn 模型来纠正此错误
- scala - exitBlockOnFail 导致我的脚本失败,“执行失败:没有名为”的属性
- typescript - 如何在 TypeScript 中将类型映射合并为单个平面类型
- python - 如何更改 .pptx 文件的特定单词的字体颜色?
- android - 从第一个位置删除子视图并将其添加到最后一个位置
- angular - 未捕获的类型错误:无法在我的开发人员工具上读取未定义的属性“拆分”