【问题标题】:Android: Manifest merger faild : Attribute application@appComponentFactoryAndroid:清单合并失败:属性 application@appComponentFactory
【发布时间】:2019-03-12 07:22:52
【问题描述】:

我在编译时收到以下错误。

清单合并失败:属性 application@appComponentFactory 值=(android.support.v4.app.CoreComponentFactory)来自 [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 也出现在 [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 值=(androidx.core.app.CoreComponentFactory)。建议:加 'tools:replace="android:appComponentFactory"' 到元素 在 AndroidManifest.xml:5:5-27:19 处进行覆盖。

谁能帮我解决这个问题。

build.gradle

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
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'
//additional android libs
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// third-party libs
implementation 'com.jakewharton:butterknife:10.1.0' // butter-knife
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0' // butter-knife
implementation 'com.stepstone.stepper:material-stepper:4.3.1' // registration stepper

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example">

    <application
        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">
        <activity android:name=".RegisterTravelerActivity"></activity>
        <activity
            android:name=".LoginActivity"
            android:theme="@style/AuthTheme" />
        <activity
            android:name=".SplashActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="@string/app_name"
            android:theme="@style/SplashScreenTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

【问题讨论】:

  • 它不工作。给出另一个错误Android Material and appcompat Manifest merger failed 我发现原因是ButterKnife 库。有什么想法吗?
  • 迁移到 Android X 并在 gradle 文件中添加 Java 8 的编译选项。

标签: android


【解决方案1】:

我面临同样的修复问题,您必须检查所有第三方库版本一是否使用 android x lib。找到那个lib并降低lib版本

另一种方法是您必须将 appcompat lib 和其他 lib 更新为 android x lib

【讨论】:

    猜你喜欢
    • 2019-08-08
    • 2019-11-19
    • 1970-01-01
    • 1970-01-01
    • 2019-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多