play-services-ads:24.0.0 resource xml/gma_ad_services_config not found
Problem
When upgrading from play-services-ads:23.6.0
to version 24.0.0
, developers encounter the following build error:
AAPT: error: resource xml/gma_ad_services_config (akacom.test.test:xml/gma_ad_services_config) not found.
This error occurs because Google removed the automatic inclusion of the gma_ad_services_config
resource in version 24.0.0, but existing AndroidManifest.xml files may still reference it.
Solution
Remove AD_SERVICES_CONFIG from Android Manifest
The primary solution is to remove or comment out the AD_SERVICES_CONFIG
property from your AndroidManifest.xml
file. Google intentionally removed this configuration requirement in version 24.0.0 to prevent merge conflicts and provide developers with more flexibility.
<!-- Remove or comment out this section in AndroidManifest.xml -->
<!--
<property
android:name="android.adservices.AD_SERVICES_CONFIG"
android:resource="@xml/gma_ad_services_config"
tools:replace="android:resource" />
-->
Step-by-Step Fix
Update build.gradle:
gradleimplementation 'com.google.android.gms:play-services-ads:24.0.0'
Modify AndroidManifest.xml: Locate and remove the
AD_SERVICES_CONFIG
property tag or comment it out as shown above.Sync and Build:
- Sync your project with Gradle files
- Clean and rebuild your project
WARNING
If you had previously created a custom xml/gma_ad_services_config.xml
file in your project, you should also remove it as it's no longer needed in version 24.0.0+.
Explanation
According to Google's official announcement, this change was made to:
"Prevent merge conflicts for apps that configure API-specific Ad Services, we've removed the android.adservices.AD_SERVICES_CONFIG property tag from the SDK's manifest file. This change provides greater flexibility for developers who need to customize their Ad Services configurations."
The AD_SERVICES_CONFIG
property is no longer necessary in version 24.0.0 and later, as the SDK now handles Ad Services configuration differently. Removing the manual reference resolves the missing resource error while maintaining full Ad Services functionality.
Additional Information
For more details about this change and other updates in version 24.0.0, refer to the official Google Ads Developers blog post.
Version Compatibility
This solution applies specifically to play-services-ads version 24.0.0 and later. If you're using an earlier version, you should keep the AD_SERVICES_CONFIG property in your manifest.