解决 Manifest merger failed with multiple errors, see logs问题

在android开发的时候,有时候会遇到这样的问题:
Manifest merger failed with multiple errors, see logs
1
1
 
1
Manifest merger failed with multiple errors, see logs

但是要命的是,你管你怎么找,除了这个log,再 没有什么其他的有用信息了,怎么办?

处理方式是这样的:
首先进入命令行,输入命令
gradlewprocessDebugManifest--stacktrace
1
1
 
1
gradlewprocessDebugManifest--stacktrace
其中, processDebugManifest是用于调试清单文件的,这个命令会获取更多的log信息。
然后会输出很多信息,其中有用的是这一部分:
> Task :app:processDebugManifest FAILED
C:\Android\_coder\_workspace_as\DDComponent_Simple\app\src\main\AndroidManifest.xml:6:5-20:19 Error:
        tools:replace specified at line:6 for attribute android:theme, but no new value specified
C:\Android\_coder\_workspace_as\DDComponent_Simple\app\src\main\AndroidManifest.xml Error:
        Validation failed, exiting

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
7
7
 
1
> Task :app:processDebugManifest FAILED
2
C:\Android\_coder\_workspace_as\DDComponent_Simple\app\src\main\AndroidManifest.xml:6:5-20:19 Error:
3
        tools:replace specified at line:6 for attribute android:theme, but no new value specified
4
C:\Android\_coder\_workspace_as\DDComponent_Simple\app\src\main\AndroidManifest.xml Error:
5
        Validation failed, exiting
6
7
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

卧槽,一看我就明白了,原来是这里写错了:
<application
	android:name=".MyApplication"
	android:allowBackup="false"
	android:icon="@drawable/app_icon"
	android:label="@string/app_app_name"
	tools:ignore="GoogleAppIndexingWarning"
	tools:replace="android:icon,android:theme,android:label,android:allowBackup">
x
1
<application
2
    android:name=".MyApplication"
3
    android:allowBackup="false"
4
    android:icon="@drawable/app_icon"
5
    android:label="@string/app_app_name"
6
    tools:ignore="GoogleAppIndexingWarning"
7
    tools:replace="android:icon,android:theme,android:label,android:allowBackup">
本来 replace 是用于合并清单文件时替换依赖库或子module中的配置的,但是这里因为没有指定 theme ,所以是不能直接替换 theme 的,修改方式当然相应的有两种,一种是指定 theme,另一种是不替换 theme。

2018-8-20

猜你喜欢

转载自www.cnblogs.com/baiqiantao/p/9503491.html