Exclude GMA Next-Gen SDK modules

In 2027, AdMob Mediation adapters transition to build against GMA Next-Gen SDK. We recommend you migrate to GMA Next-Gen SDK. To continue using Google Mobile Ads SDK (Legacy) with AdMob Mediation and avoid compile errors related to duplicate symbols, exclude GMA Next-Gen SDK. This process prevents mediation adapters from pulling GMA Next-Gen SDK as a dependency.

In your app-level build.gradle file, exclude the ads-mobile-sdk module globally from all dependencies:

Kotlin

configurations.configureEach {
    exclude(group = "com.google.android.libraries.ads.mobile.sdk", module = "ads-mobile-sdk")
}

Groovy

configurations.configureEach {
    exclude group: "com.google.android.libraries.ads.mobile.sdk", module = "ads-mobile-sdk"
}