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

Error: execution completed for task ': app: processDebugManifest'.

Manifest merge 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 also present in [com.android.support:support-v13:26.0.1] AndroidManifest.xml: 28: 13-35 value = (26.0.1). Suggestion: add "tools: replace =" android: value "" to the AndroidManifest.xml: 26: 9-28: 38 element 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>

, , . , ?

+6
8
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'
            }
        }
    }
}

, build.gradle , , "26.0.1".

+12

, - :

: 'tools: replace = "android: " " AndroidManifest.xml

, (26.0.2). 26.1.0 :

<meta-data
    tools:replace="android:value"
    android:name="android.support.VERSION"
    android:value="26.1.0" />
+7

gradle

    compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:preference-v7:26.+'
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') {
    exclude module: 'support-v4'
    exclude module: 'com.android.support'
    exclude module: 'com.google.android'
}
compile ('com.afollestad.material-dialogs:commons:0.9.4.7'){
    exclude module: 'support-v4'
    exclude module: 'com.android.support'
    exclude module: 'com.google.android'
}
+2

, com.afollestad.material-dialogs:core:0.9.4.7 26.0.1, , . + :

compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:support-v4:26.0.1'
+1

, 26.0.1 26.0.2,

implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:recyclerview-v7:26.0.2'
implementation 'com.android.support:cardview-v7:26.0.2'
0

, . .

(26.1.0), !

compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-v4:26.1.0'

, , .

0

gradle

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'
            }
        }
    }
}
0

I had a similar exception when I used androidx libraries added to gradle.properties solved the dependency problem:

android.enableJetifier=true
android.useAndroidX=true
0
source

Source: https://habr.com/ru/post/1684977/


All Articles