清单合并工具:替换没有任何影响

Evg*_*urg 3 android android-manifest android-studio android-gradle-plugin

我在我的应用程序中使用了image-chooser-library,其中定义了android:icon所以我需要覆盖此属性以便gradle成功构建:

<?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="com.sample.sample">

    <application
        android:icon="@drawable/icon"
         tools:replace="icon"/>

</manifest>
Run Code Online (Sandbox Code Playgroud)

但我仍然得到以下内容:

清单合并失败:来自AndroidManifest.xml的属性应用程序@ icon value =(@ drawable/icon):com.kbeanie中也存在20:9:image-chooser-library:1.4.3:13:9 value =(@ drawable/ic_launcher)建议:在AndroidManifest.xml:15:5中添加'tools:replace ="android:icon"'到元素

有什么建议?

小智 13

我有同样的问题,因为它发生在多个构建机器上,当创建一个仅导致问题的库的测试项目时,一切正常,我怀疑清单合并工具中的一些错误.

我通过更改gradle文件中的依赖项顺序来修复它(导致问题的库是列表中的最后一个,我将它移到顶部).