0

My app is working fine, but after adding Mobile Ads SDK, it stops syncing.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "abc
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets {
        main {
            assets.srcDirs = ['src/main/assets', 'src/main/assets/images', 'src/main/assets/databases'] 
            res.srcDirs =['src/main/res', 'src/main/res/menu', 'src/main/res/anim', 'src/main/res/values-ja']
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.sothree.slidinguppanel:library:3.4.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
    implementation 'com.google.android.gms:play-services-ads:17.1.1'
}

This is the error.

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.2) from [com.android.support:recyclerview-v7:26.0.2] AndroidManifest.xml:25:13-35 is also present at [com.android.support:customtabs:26.1.0] AndroidManifest.xml:25:13-35 value=(26.1.0). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:23:9-25:38 to override.

I don't know what the error means, have anyone encountered the same problem?

Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98
EagerToLearn
  • 675
  • 7
  • 24
  • Possible duplicate of [Android: Getting "Manifest merger failed" error after updating to a new version of gradle](https://stackoverflow.com/questions/43280871/android-getting-manifest-merger-failed-error-after-updating-to-a-new-version) – Nithis Kumar Feb 11 '19 at 06:16

3 Answers3

1

Problem:

Problem is support library version is getting conflicted.

Solution:

First step you need to try is using a common version of support library, you can declare a common variable:

supportLibraryVersion=28.0.0

And refer the same for all the dependencies of the same package:

implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:support-v4:$supportLibraryVersion"

Second step: You need to debug the dependencies list, use the ./gradlew dependencies command which will list dependencies tree. Analyse the dependencies tree, you will get to see which library is internally referring which version of the support library:

For example, this older version of the library: com.android.support:recyclerview-v7:26.0.2

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
0

The mobile Ads SDK might have a support library version which is different that is being used in your application. The error clearly says that there is a different version in your AndroidManifest.xml file. The error also suggests -

add 'tools:replace="android:value"' to element at AndroidManifest.xml:23:9-25:38 to override

It also shows the lines where you need to add this. I think that should solve the problem.

Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98
0

Open Your AndroidManifest.xml .you will see Merged Manifest below it . Now from your error log.

[com.android.support:recyclerview-v7:26.0.2] AndroidManifest.xml:25:13-35 is also present at [com.android.support:customtabs:26.1.0] AndroidManifest.xml:25:13-35 value=(26.1.0).

Your manifest is having conflict with two version for same library.So click on Merged Manifest and your will get

add 'tools:replace="android:value"' to element at AndroidManifest.xml:23:9-25:38 to override

Click on it . and issue will be solved.

Tejas Pandya
  • 3,987
  • 1
  • 26
  • 51