1
votes

I found similar issue @ Android studio Gradle icon error, Manifest Merger.

But none of the suggestion works for me. I am using Android Studio 3.2. and in my application, I am using app-> build.gradle:-

 apply plugin: 'com.android.application'


    android {
        compileSdkVersion 25
        buildToolsVersion '28.0.2'
        defaultConfig {
            applicationId "com.home.ma.photolocationnote"
            minSdkVersion 16
            targetSdkVersion 27
            versionCode 6
            versionName "6.0"
            multiDexEnabled = true
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            targetCompatibility 1.8
            sourceCompatibility 1.8
        }
    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        implementation 'com.android.support:appcompat-v7:25.0.0'
        implementation 'com.android.support:design:25.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        implementation 'com.microsoft.azure.android:azure-storage-android:2.0.0@aar'
        implementation 'javax.xml.stream:stax-api:1.0-2'
        implementation 'org.apache.commons:commons-lang3:3.0'
        implementation 'com.google.firebase:firebase-core:16.0.1'
        implementation 'com.google.android.gms:play-services-analytics:16.0.0'
        implementation 'com.google.android.gms:play-services-maps:15.0.1'
        implementation 'com.google.android.gms:play-services-location:15.0.1'
        implementation 'com.google.android.gms:play-services-gcm:15.0.1'
       // after adding this lib
        implementation 'com.microsoft.azure:notification-hubs-android-sdk:0.4@aar'
        // after adding this lib 
        implementation 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar' 

        testImplementation 'junit:junit:4.12'
    }

Project -> build.gradle :-

  buildscript {
        repositories {
            jcenter()
            google()
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.0'
            classpath 'com.google.gms:google-services:4.0.1'

            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

    allprojects {
        repositories {
            jcenter()
            google()
            mavenCentral()
        }
    }

    task clean(type: Delete) {
        delete rootProject.buildDir
    }

I got an error as Manifest merger failed with multiple errors, see logs

I added suggested xmlns:tools="http://schemas.android.com/tools" and tools:replace="android:icon,android:theme,android:label,android:name"

Here is my AndroidManifest.xml:-

 <?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.home.ma.photolocationnote">

        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

        <permission
            android:name="com.home.ma.photolocationnote.permission.MAPS_RECEIVE"
            android:protectionLevel="signature" />

        <uses-permission android:name="com.home.ma.photolocationnote.permission.MAPS_RECEIVE" />
        <uses-permission android:name="com.google.android.providers.gsf.permisson.READ_GSERVICES" />

        <supports-screens
            android:largeScreens="true"
            android:normalScreens="true"
            android:smallScreens="true"
            android:xlargeScreens="true" />

        <uses-feature
            android:glEsVersion="0x00020000"
            android:required="true" />

        <application
            tools:replace="android:icon,android:theme,android:label,android:name"
            android:allowBackup="true"
            android:icon="@mipmap/app_icon" // I tried "@drawable/app_icon" also.  
            android:label="@string/app_name"
            android:largeHeap="true"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
            <meta-data
                android:name="com.google.android.geo.API_KEY"
                android:value="xxxxxxxxx" />

            <activity
                android:name=".MainActivity"
                android:label="@string/app_name"
                android:theme="@style/AppTheme.NoActionBar"></activity>

            <meta-data
                android:name="com.google.android.gms.vision"
                android:value="@integer/google_play_services_version" />


            <activity
                android:name=".MapsActivity"
                android:label="@string/title_activity_maps"
                android:theme="@style/AppTheme.NoActionBar">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity android:name=".CameraActivity" />
            <activity
                android:name=".NoteEditorActivity"
                android:label="@string/title_activity_note_editor"
                android:theme="@style/AppTheme.NoActionBar" />

            <provider
                android:name=".contentProvider.NoteContentProvider"
                android:authorities="authorities.photolocationnote.contentprovider"
                android:exported="true" />

            <activity
                android:name=".NoteListActivity"
                android:label="@string/title_activity_note_list"
                android:theme="@style/AppTheme.NoActionBar" />

        </application>

    </manifest>

Error msg:-

Manifest merger failed : Attribute application@icon value=(@drawable/app_icon) from AndroidManifest.xml:31:9-42 is also present at [com.microsoft.azure:azure-notifications-handler:1.0.1] AndroidManifest.xml:13:9-45 value=(@drawable/ic_launcher). Suggestion: add 'tools:replace="android:icon"' to element at AndroidManifest.xml:29:5-76:19 to override.

1
previous it was working ?Faiz Mir
Yes. It was fine. As soon as i added this 2 lib implementation 'com.microsoft.azure:notification-hubs-android-sdk:0.4@aar' implementation 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar' I got the error msg.masiboo
if you remove that its work ?Faiz Mir
Change the name of the file from app_icon to something else and try.Ümañg ßürmån
Yes, just tested by removing this 2 lib, it compiles fine. So it should work. If you see the error mes I added in the bottom, it clearly says the issue. But if I added the usggested too in my manifest.xml. It didn't help.masiboo

1 Answers

1
votes

Solution:

Change your application tag from this:

<application
        tools:replace="android:icon,android:theme,android:label,android:name"
        android:allowBackup="true"
        android:icon="@mipmap/app_icon" // I tried "@drawable/app_icon" also.  
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

To this:

<application
        android:allowBackup="true"
        android:icon="@mipmap/app_icon" 
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:icon">

Try it, Hope it helps.