Android Material 和 appcompat Manifest 合并失败 [英] Android Material and appcompat Manifest merger failed
本文介绍了Android Material 和 appcompat Manifest 合并失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有下一年级
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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.material:material:1.0.0-rc01'
}
但是当我想构建应用程序时,我会得到下一个日志:
But when I want to build app I get next log:
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0-alpha3] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0-alpha3] 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.
好的!转到清单并执行此操作:
Okey! Go to manifest and do it:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="ru.chopcode.myapplication">
<application
tools:replace="android:appComponentFactory"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
</application>
</manifest>
然后我在我的 Logcat 中收到此错误:
Then I get this error in my Logcat:
Manifest merger failed with multiple errors, see logs that I have Linked with it
推荐答案
我遇到了类似的问题.在 gradle.properties
文件中添加了两行:
I had similar problem. Added two lines in gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
这两行自动解决了我的google文件和第三方依赖之间的依赖冲突.这是要遵循的链接:https://developer.android.com/topic/libraries/support-library/androidx-overview#new-project
These two lines automatically resolved my dependency conflicts between google's files and third party dependencies. Here's the link to follow: https://developer.android.com/topic/libraries/support-library/androidx-overview#new-project
这篇关于Android Material 和 appcompat Manifest 合并失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文