Manifest merger failed with multiple errors, see logs 问题汇总

Manifest merger failed with multiple errors, see logs

最常见的原因:AS的Gradle插件默认会启用Manifest Merger Tool,若Library项目中也定义了与主项目相同的属性(例如默认生成的Android:icon和Android:theme),则此时会合并失败,并报上面的错误。

解决办法:在manifest根标签上加入xmlns:tools="http://schemas.android.com/tools",并在Manifest.xml的application标签下添加tools:replace="icon,label,theme"(多个属性用,隔开,视情况而定)。或者tools:replace="android:icon, android:label, android:theme"

其他原因见 Manifest merger failed with multiple errors, see logs -- Android Studio问题汇总

而我项目中碰到的问题是

        <receiver android:name=".***.***.MyJPushMessageReceiver"
            android:enabled="true">
            <intent-filter>
                <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />

                <category android:name="${APPLICATION_ID}" />
            </intent-filter>
        </receiver>

该段代码中 ${APPLICATION_ID} 没有在gradle中定义。。。所以在build.gradle定义好就行

    productFlavors {
        flavors_debug {
            manifestPlaceholders = [
                    MY_APP_NAME   : "***重构版",
                    APPLICATION_ID: "com.***.***"
            ]
            applicationId "com.***.***"
        }
    }

其中牵扯到其他问题:build出错时没有打印出详细信息

在terminal中输入命令 gradlew processDebugManifest --debug 打开了gradle的debug信息打印,才发现到了具体错误信息。

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