当前位置: 代码迷 >> Android >> 甚至用工具清除合并投掷错误:replace =“android:icon,android:theme”
  详细解决方案

甚至用工具清除合并投掷错误:replace =“android:icon,android:theme”

热度:65   发布时间:2023-08-04 09:50:09.0

即使使用tools:replace="android:icon,android:theme"我在显示合并时遇到问题tools:replace="android:icon,android:theme"

注意:我只在这里发布应用程序标签

我的主要app Manifest如下:

<?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中的drawable ic_launcher替换为您的应用徽标即可。

应用程序将合并两个清单,您将获得所需的主题,并将从PayU的清单中获取徽标,因此您将用您的ic_launcher替换它们

  相关解决方案