android - 这是什么意思?添加 'tools:replace="android:appComponentFactory"' 到元素
问题描述
我正在尝试在我的 Android 应用程序中使用 firebase。
这是我的 Build.gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.ecommerce5"
minSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-analytics:17.2.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'
}
apply plugin: 'com.google.gms.google-services'
当我删除以下代码行并运行应用程序时,应用程序运行良好。
implementation 'com.google.firebase:firebase-analytics:17.2.0'
但是当我添加上面的行并运行代码时,应用程序显示以下错误:
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0-rc02] 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:5:5-19:19 to override.
这是什么意思?
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-24:19 to override.
解决方案
错误消息为您的问题提供了解决方案
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0-rc02] 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:5:5-19:19 to override.
您需要在清单中添加替换标签:
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.
推荐阅读
- javascript - ECONNREFUSED 尝试连接数据库时出错 [discord.js, mysql, phpmyadmin]
- javascript - 如何修复此错误 - > Uncaught (in promise) SyntaxError: Unexpected end of input In Fetch Api
- html - pycharm不接受html文件
- javascript - 比较字符串以确保“RickAstley”是唯一可以触发歌曲的东西
- javascript - 试图从javascript中的数组中获取计数
- javascript - 使用 discord.js 通过其 id 获取频道/公会名称
- javascript - React Native 在执行任何其他 API 调用之前等待一个 API 调用完成
- c++ - 变量模板的编译器问题
- c# - Microsoft Identity 如何将数据库更新为新表设计
- javascript - 如何将具有背景颜色的单元格范围值放入单个数组中?