androidgradle

Manifest merger failed with AGP 8.3.0


I'm trying to upgrade my project to AGP 8.3.0 but I'm getting the error:

Attribute property#android.adservices.AD_SERVICES_CONFIG@resource value=(@xml/ga_ad_services_config) from [com.google.android.gms:play-services-measurement-api:21.5.1] AndroidManifest.xml:32:13-58
    is also present at [com.google.android.gms:play-services-ads-lite:22.6.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.

Any idea on how to fix this?

I don't have anything related to AD_SERVICES_CONFIG in my manifest file.


Solution

  • Problem is definitely not with your AndroidManifest.xml file, but rather the files that are bundled with the external Google services libraries that you have implemented in your application. Yes, sometimes they may conflict with each other (as all manifests are merged during app build) and this seems to be the case.

    Eventually, Google will address this issue, but for now you can either downgrade your dependencies (need to figure out which ones, but AGP 8.2.2 didn't have this problem AFAIK).

    Or, just do as suggested by the error log, and solve the conflict by adding this block to your AndroidManifest.xml file:

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

    Note: I would still recommend going back to AGP 8.2.2 if your project is important, since new releases are always risky and this might not be the only problem in the updated Gradle plugin