提问人:Piyush Mishra 提问时间:5/2/2019 更新时间:5/2/2019 访问量:423
将 WorkManager 添加为依赖项时清单合并失败
Manifest merger failed while adding WorkManager as dependency
问:
我正在将 WorkManager 添加为依赖项,但陷入了错误。我收到错误 请解释问题是什么以及如何解决它。Manifest merger failed
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] 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:10:5-24:19 to override.
我在主要方向上的build.gradle是这个
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.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
}
我在应用程序目录中的build.gradle是这个
应用
plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "sng.urrsm.calllog"
minSdkVersion 19
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'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "androidx.work:work-runtime:2.0.1"
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'
}
我添加了 build.gradle,它存在于 app 目录中。implementation "androidx.work:work-runtime:2.0.1"
答: 暂无答案
评论
com.android.support