Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I add third party dependencies I get a manifest merger fail, what should I do to fix this?

Tags:

android

Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.2) from [com.android.support:design:26.0.2] AndroidManifest.xml:28:13-35 is also present at [com.android.support:support-v13:26.0.1] AndroidManifest.xml:28:13-35 value=(26.0.1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override. apply plugin: 'com.android.application'

app.gradle file

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.dharquissandas.budget"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

allprojects{
    repositories{
        jcenter()
            maven{
                url "https://maven.google.com"
            }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:preference-v7:23.4.0'
    compile 'com.android.support:design:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:26.+'
    compile 'com.afollestad.material-dialogs:core:0.9.4.7'
    compile 'com.afollestad.material-dialogs:commons:0.9.4.7'
    testCompile 'junit:junit:4.12'
}

android manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.dharquissandas.budget">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            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=".add_expense"
            android:label="@string/title_activity_add_expense"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity
            android:name=".add_income"
            android:label="@string/title_activity_add_income"
            android:theme="@style/AppTheme.NoActionBar" />
    </application>

</manifest>

This was working and then suddenly it stopped working when I wanted to work on the app again. What should I do to fix this error?

like image 925
Deep Harquissandas Avatar asked Sep 03 '17 13:09

Deep Harquissandas


People also ask

How do I fix a failed manifest merger?

Try adding the following labels to resolve the issue: Add the xmlns:tools line in the manifest tag. Add tools:replace= or tools:ignore= in the application tag.

How do you do merged manifest?

Inspect the merged manifest and find conflicts Even before you build your app, you can see a preview of what your merged manifest looks by opening your AndroidManifest. xml file in Android Studio, and then clicking the Merged Manifest tab at the bottom of the editor.

How do I edit Android manifest?

The Android manifest file is a specially formatted XML file. You can edit the XML manually by clicking on the AndroidManifest. xml tab. Android manifest files generally include a single <manifest> tag with a single <application> tag.

Where is the Android manifest file located?

The file is located at WorkspaceName>/temp/<AppName>/build/luaandroid/dist. The manifest file provides essential information about your app to the Android operating system, and Google Play store. The Android manifest file helps to declare the permissions that an app must have to access data from other apps.


1 Answers

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.1'
            }
        }
    }
}

This helped me, add this to your build.gradle and make sure you are using the same versions as '26.0.1'.

like image 174
Muhammadakbar Rafikov Avatar answered Sep 30 '22 21:09

Muhammadakbar Rafikov