【问题标题】:Android Studio, Manifest merger failed with multiple errorsAndroid Studio,清单合并失败,出现多个错误
【发布时间】:2021-07-06 14:01:34
【问题描述】:

当我调试我的项目时,出现错误“Manifest merge failed with multiple errors, see logs”

任务“:app:processDebugMainManifest”执行失败。 错误: 属性 application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) 来自 [androidx.core:core:1.5.0] AndroidManifest.xml:24:18-86 也存在于 [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory)。 建议:将 'tools:replace="android:appComponentFactory"' 添加到 AndroidManifest.xml:5:5-22:19 的元素以覆盖。

AndroidManifest.xml

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

    <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/Theme.Transparent">
        <activity android:name=".RegisterActivity"></activity>
        <activity android:name=".StartActivity" />
        <activity android:name=".LoginActivity" />
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

【问题讨论】:

  • 你能分享一下你的gradle依赖列表吗?
  • @GaganBatra 实现 'androidx.appcompat:appcompat:1.3.0' 实现 'com.google.android.material:material:1.3.0' 实现 'androidx.constraintlayout:constraintlayout:2.0.4'实施 'androidx.legacy:legacy-support-v4:1.0.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso- core:3.3.0' 实现 'com.etebarian:meow-bottom-navigation-java:1.2.0'

标签: android android-studio


【解决方案1】:

打开应用程序清单 (AndroidManifest.xml) 并单击编辑窗格底部的 Merged Manifest 选项卡。查看下图:

从图片中可以看到右栏中的错误,尝试解决错误。它可能会帮助有同样问题的人。阅读更多here

另外,一旦你发现错误并且你从你正在使用的外部库中得到那个错误,你必须让编译器忽略来自外部库的属性。 //在manifest的application标签中添加这个属性

   tools:replace="android:allowBackup" 
                                                                                                                                          
   //Add this in the manifest tag at the top

   xmlns:tools="http://schemas.android.com/tools"

【讨论】:

    【解决方案2】:

    转到您的 Gradle File(Module App) 找到并从您的依赖项中删除此行。

    implementation 'com.android.support:support-compat:28.0.0'
    

    然后Sync Gradle 应用更改。

    问题应该解决了。

    【讨论】:

    • 删除实现 'com.etebarian:meow-bottom-navigation-java:1.2.0' 后错误消失了,但我想使用这些依赖项
    • 很好的观察 - 在这种情况下使用 Java 的 Kotlin 版本,即用 implementation 'com.etebarian:meow-bottom-navigation:1.3.1' 替换 navigation-java
    猜你喜欢
    • 2016-06-20
    • 2021-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-25
    • 1970-01-01
    • 2020-01-10
    • 1970-01-01
    相关资源
    最近更新 更多