我正在尝试将我的应用程序与 firebase 连接,因此我添加了 类路径、实现和“应用插件”到我的 graddle 文件
但是当我尝试运行应用程序时,会发生此错误:
list 合并失败:来自 [com.android.support:support-compat:28.0.0] 的属性 application@appComponentFactory value=(android.sustrong textpport.v4.app.CoreComponentFactory) 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:5:5-24:19 的元素中进行覆盖。
问题是当我添加时
tools:replace="android:appComponentFactory"
在建议中,出现了更多错误。 我该如何解决这个问题?
这是我的 gradle 文件。模块:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "lt.tetro.testapp"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:17.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'
}
apply plugin: 'com.google.gms.google-services'
项目:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
最佳答案
firebase-core:17.0.0
包含在 AndroidX 中,因此请更新您的应用以使用 Jetpack (AndroidX)。
您可以查看以下链接中的说明:
https://developer.android.com/jetpack/androidx/migrate
with Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
关于java - 尝试连接到 firebase 时 list 合并失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57172335/