android - Android - 更新到 API 28 后生成错误(清单合并失败)
问题描述
我正在尝试使用最新的库作为我的要求的一部分。我确实将 gradle 版本升级到了 3.1.4 以及所有具有匹配编译和目标 SDK 版本的支持库,但是在构建项目时我得到了
错误:清单合并失败:来自 [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 的属性 application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) 也是出现在 [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory)。建议:将 'tools:replace="android:appComponentFactory"' 添加到 AndroidManifest.xml:28:5-122:19 的元素以覆盖。
我的 app-build.gradle 看起来像这样:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "propelit.actionopps.com.propelit"
minSdkVersion 21
targetSdkVersion 28
versionCode 7
versionName "1.7"
multiDexEnabled true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
externalNativeBuild {
}
}
repositories {
mavenCentral()
mavenLocal()
flatDir {
dirs 'libs'
}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
implementation(name: 'HERE-sdk', ext: 'aar')
implementation 'com.victor:lib:1.0.4'
implementation 'com.google.code.gson:gson:2.8.5'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:preference-v14:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.github.markushi:circlebutton:1.1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.5+'
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.android.support:multidex:1.0.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'
我的项目级 build.gradle 看起来像这样
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
url 'https://maven.fabric.io/public'
}
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'io.fabric.tools:gradle:1.29.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
mavenLocal()
maven { url "https://jitpack.io"
}
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
任何人都请说明我在这里可能做错了什么?
解决方案
由于我认为您正在使用AndroidX
新旧库,因为Android Support
关于两者的错误说明androidx.core.app.CoreComponentFactory
and android.support.v4.app.CoreComponentFactory
,请在您的 中添加以下内容gradle.properties
:
android.useAndroidX=true
android.enableJetifier=true
这应该可以解决这些依赖冲突。希望能帮助到你!
推荐阅读
- reactjs - 在 react.js 中显示时钟
- reactjs - 反应表日期范围过滤器
- reactjs - 强制使用两个道具之一调用反应组件
- data-structures - 使用递归树,求解递归 T(n) = T(n − 1) + O(n)
- java - 已签名的 APK 无法使用 multiDexKeepProguard 打开
- r - case_when 可以报告它选择的变量的名称及其值吗?
- c# - RDLC 报告在部署到 IIS 服务器后不显示。它在我正在开发应用程序的同一系统上工作
- amazon-web-services - 为什么将 getSignedUrl 的结果存储在数据库中是个坏主意?
- c# - 带有参数 c# 的并行任务运行
- javascript - 通过在 Vuejs 中选择语言来改变方向