- 原因描述:
今天遇到一个问题,如下图所示。先说下出现的原因,我将注册码认证的逻辑上传到jcenter上,然后在本地代码中引用时出现了这个问题。
- 解决
看到这个问题的时候不要着急,看AS提示。android Studio 右下角的Gradle Console
如上图所示,Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.
Run with –stacktrace Run with –info –debug option 这三个链接其实是gradle命令,目的是查看更多的报错信息。
点击Run with –info,看下提示的内容。
问题找到了,原来是因为在gradle中引用的上传到jcenter上的jar包里也有meta-data信息
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="81f9b6f7********343618fc95" />
本地的代码里也有meta-data信息,都是高德地图需要配置的key。
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="060efe7********8564b90c28"
/>
现在按gradle提示的信息,添加tools:replace=”android:value”这个字段
首先要在 标签中增加一个 tools 的命名空间 :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.celllocation"
android:versionCode="1"
android:versionName="1.0">
然后在meta-data里面添加tools:replace=”android:value”,如下所示
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="060efe739*******708564b90c28"
tools:replace="android:value" />
重新编译运行。
多么熟悉的画面。完美解决。
其实报Error:Execution failed for task ‘:processDebugManifest’.
Manifest merger failed with multiple errors, see logs这个错误的原因有很多。本文主要讲怎么去解决这类问题。