【发布时间】:2019-06-21 17:13:46
【问题描述】:
我是 Android 开发的新手,但我一生都无法弄清楚这个错误,我尝试了解决方案 here 和 here。我仍然无法让这个应用程序运行。
错误是
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:5:5-19:19 to override.
这是我的 build.gradle 文件
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "n8tivedesigns.com.full_rack_mobile"
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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
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.google.android.gms:play-services-maps:17.0.0'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}
非常感谢任何帮助。
【问题讨论】:
-
你添加了
tools:replace="android:appComponentFactory",但什么也没发生? -
我做了,上面写着
The prefix "tools" for attribute "tools:replace" associated with an element type "application" is not bound. -
所以试试下面我的回答,看看是否有帮助
-
这是什么时候开始的?你做了什么?
-
@Shermano 我添加了它并删除了那个错误,但添加了
Error: tools:replace specified at line:6 for attribute android:appComponentFactory, but no new value specified app main manifest (this file), line 5
标签: android gradle kotlin android-gradle-plugin