Search code examples
androidadmobgoogle-play-servicesandroid-manifest

Android: Manifest merger failed, add 'tools:replace="android:resource"' to <property> element


On Android, I am using the latest libraries for Firebase and AdMob:

implementation 'com.google.android.play:core:1.10.3'
implementation 'com.google.android.gms:play-services-ads:23.1.0'
implementation platform('com.google.firebase:firebase-bom:33.1.0')

And I get his error when I try to build the app

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':TrenitApps:processDebugMainManifest'.
Caused by: java.lang.RuntimeException: Manifest merger failed : Attribute property#android.adservices.AD_SERVICES_CONFIG@resource value=(@xml/ga_ad_services_config) from [com.google.android.gms:play-services-measurement-api:22.0.1] AndroidManifest.xml:32:13-58
    is also present at [com.google.android.gms:play-services-ads-lite:23.1.0] AndroidManifest.xml:92:13-59 value=(@xml/gma_ad_services_config).
    Suggestion: add 'tools:replace="android:resource"' to <property> element at AndroidManifest.xml to override.

How can I fix this problem? I actually don't have a <property> element in my AndroidManifest.xml


Solution

  • This is a known issue which has already been raised and Google's Devs at AdMob might fix it

    You can meanwhile fix it by adding fixes suggested here to your AndroidManifest.xml

    <property
            android:name="android.adservices.AD_SERVICES_CONFIG"
            android:resource="@xml/gma_ad_services_config"
            tools:replace="android:resource" />