即使 tools:replace="android:icon,android:theme" 也出现清单合并抛出错误
Manifest merge throwing error even with tools:replace="android:icon,android:theme"
我在使用 tools:replace="android:icon,android:theme"
进行清单合并时遇到问题
注意:我在这里只发布应用程序标签
我的主要应用清单如下:
<?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="in.gobo"
android:installLocation="auto">
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="22" />
<permission
android:name=".permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name=".permission.C2D_MESSAGE" />
<!--tools:replace="icon, label"-->
<application
android:name=".code.GoboApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
>
我的模块清单如下:
<?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.payUMoney.sdk" >
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.VIBRATE" />
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!-- Create and manage accounts on device -->
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-feature
android:name="android.hardware.flash"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<!-- <permission
android:name="com.payUMoney.sdk.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.payUMoney.sdk.permission.C2D_MESSAGE" />-->
<!-- App receives GCM messages. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Extract device IEMI number -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- Access Wifi State -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-feature
android:name="android.hardware.telephony"
android:required="false"
/>
<!--tools:replace="android:icon"
-->
<application
android:allowBackup="true"
android:windowSoftInputMode="adjustPan"
android:icon="@drawable/green_app_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme"
tools:replace="android:icon,android:theme"
>
和编译时抛出错误
:
Error:(43, 9) Attribute application@icon value=
(@drawable/ic_launcher) from AndroidManifest.xml:43:9 Error:(45, 9)
Attribute application@theme value=(@style/AppTheme) from
AndroidManifest.xml:45:9 is also present at gobo-user:PayUMoneySDK-
Android:unspecified:67:9 value=(@style/MyTheme) Suggestion: add
'tools:replace="android:theme"' to <application> element at
AndroidManifest.xml:40:5 to override Error:Execution failed for task
':app:processDebugManifest'. Manifest merger failed with multiple
errors, see logs
只需从您的应用程序清单中删除 icon="@drawable/ic_launcher"
和 theme="@theme/MyTheme"
并将 PayU SDK 中的可绘制对象 ic_launcher 替换为您的应用程序徽标即可。
应用程序将合并两个清单,您将从 PayU 的清单中获取所需的主题和徽标,因此您可以将它们的 ic_launcher 替换为您的
我在使用 tools:replace="android:icon,android:theme"
注意:我在这里只发布应用程序标签
我的主要应用清单如下:
<?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="in.gobo"
android:installLocation="auto">
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="22" />
<permission
android:name=".permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name=".permission.C2D_MESSAGE" />
<!--tools:replace="icon, label"-->
<application
android:name=".code.GoboApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
>
我的模块清单如下:
<?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.payUMoney.sdk" >
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.VIBRATE" />
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!-- Create and manage accounts on device -->
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-feature
android:name="android.hardware.flash"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<!-- <permission
android:name="com.payUMoney.sdk.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.payUMoney.sdk.permission.C2D_MESSAGE" />-->
<!-- App receives GCM messages. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Extract device IEMI number -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- Access Wifi State -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-feature
android:name="android.hardware.telephony"
android:required="false"
/>
<!--tools:replace="android:icon"
-->
<application
android:allowBackup="true"
android:windowSoftInputMode="adjustPan"
android:icon="@drawable/green_app_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme"
tools:replace="android:icon,android:theme"
>
和编译时抛出错误 :
Error:(43, 9) Attribute application@icon value=
(@drawable/ic_launcher) from AndroidManifest.xml:43:9 Error:(45, 9)
Attribute application@theme value=(@style/AppTheme) from
AndroidManifest.xml:45:9 is also present at gobo-user:PayUMoneySDK-
Android:unspecified:67:9 value=(@style/MyTheme) Suggestion: add
'tools:replace="android:theme"' to <application> element at
AndroidManifest.xml:40:5 to override Error:Execution failed for task
':app:processDebugManifest'. Manifest merger failed with multiple
errors, see logs
只需从您的应用程序清单中删除 icon="@drawable/ic_launcher"
和 theme="@theme/MyTheme"
并将 PayU SDK 中的可绘制对象 ic_launcher 替换为您的应用程序徽标即可。
应用程序将合并两个清单,您将从 PayU 的清单中获取所需的主题和徽标,因此您可以将它们的 ic_launcher 替换为您的