Fix issue with the dependencies Admob and Firebase
Aug 9, 2024
Error:
error Manifest merger failed : Attribute property#android.adservices.AD_SERVICES_CONFIG@resource value=(@xml/gma_ad_services_config)
from [com.google.android.gms:play-services-ads-lite:23.2.0] AndroidManifest.xml:92:13-59is
also present at [com.google.android.gms:play-services-measurement-api:22.0.2]
AndroidManifest.xml:32:13-58 value=(@xml/ga_ad_services_config).Suggestion:
add 'tools:replace="android:resource"' to <property> element at AndroidManifest.xml to override.
Issue happens when we add the Gradle dependencies for AdMob and Firebase. Ex:
dependencies {
//Admob config
implementation(libs.play.services.ads)
//Firebase remote config
implementation (platform("com.google.firebase:firebase-bom:33.1.2"))
implementation("com.google.firebase:firebase-config-ktx")
implementation("com.google.firebase:firebase-analytics-ktx")
}
Solution: add the below snippet to AndroidManifest.xml
<manifest>
<application>
....
....
<property
android:name="android.adservices.AD_SERVICES_CONFIG"
android:resource="@xml/gma_ad_services_config"
tools:replace="android:resource" />
</application>
</manifest>
Sync project. Fixes issue
Reference
https://firebase.google.com/docs/android/setup
https://stackoverflow.com/questions/78085458/manifest-merger-failed-with-agp-8-3-0