Manifest合并失败时,试图将我自己的标志添加到安卓应用程序-安卓工作室



我尝试在Android Studio中添加我自己的图标到我的应用程序,我遇到了Manifest合并失败。我在这里发现了一个相同的问题,但他的答案不适合我。我尝试添加tools:replace="android:icon"tools:replace="android:icon,android:theme"(当然在2个不同的场合),但没有变化。

这是Android Studio一直给我的错误

Error:(12, 9) Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@icon value=(@drawable/footynews_logo_new) from AndroidManifest.xml:12:9
    is also present at com.arasthel:gnavdrawer-library:1.1.4:4:45 value=(@drawable/ic_launcher)
    Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:9:5 to override
Error:(12, 9) Attribute application@icon value=(@drawable/footynews_logo_new) from AndroidManifest.xml:12:9

编辑:我刚刚发现,即使我认为应用程序是使用ic_launcher在我的项目目录,它实际上是使用ic_launcher在我使用的库之一。我如何强制应用程序使用我的启动器图标代替?

tools:replace="android:icon,android:theme"

应该工作。希望你添加了

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

如果这不起作用,您还有其他选择。使用旧的舱单合并。将此添加到您的build.gradle文件

android { useOldManifestMerger true }

你可以在这里找到更多信息

在manifest文件中添加两行:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="..."
    xmlns:tools="http://schemas.android.com/tools"> <!--Add this line-->
    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        tools:replace="icon, label"/> <!--Add this line-->
</manifest>

最新更新