记一次 java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs 排查

记一次 java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs 排查

进入命令行Terminal,输入命令排查

gradlew processDebugManifest --stacktrace

输出如下结果:

Attribute application@label value=(@string/zlong_app_name) from AndroidManifest.xml:62:184-222

        is also present at [:facebookres-debug:] AndroidManifest.xml:13:9-41 value=(@string/app_name).

        Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:62:3-222:17 to override

原来application的android:label有多处地方有定义,而且都用了app_name,而我这边修改了变量名,导致label合并失败.

解决办法:在Mainfest文件头加:

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

例:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"    
    xmlns:tools="http://schemas.android.com/tools"    
    package="com.anthony.test">

在application头里添加:

tools:replace="android:label"

例:

<application    
        android:name="com.anthony.test.CustomApplication"    
        android:allowBackup="true"    
        android:icon="@mipmap/ic_launcher"    
        android:label="@string/app_name"    
        android:theme="@style/AppTheme"    
        tools:replace="android:label" >

重新再运行一次 gradlew processDebugManifest --stacktrace

BUILD SUCCESSFUL in 1s
10 actionable tasks: 3 executed, 7 up-to-date

问题解决!(∩_∩)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。