-
Notifications
You must be signed in to change notification settings - Fork 444
Android: clerk-android-ui pulls in ads-mobile-sdk, conflicts with play-services-ads #8237
Description
Bug report
When using @clerk/expo@3.1.6 alongside react-native-google-mobile-ads@15.8.3, the Android build fails with duplicate class errors.
What happens
clerk-android-ui:1.0.10 transitively depends on com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk:0.21.0-beta01. This package contains the same classes as com.google.android.gms:play-services-ads-api:24.6.0 (which comes from react-native-google-mobile-ads).
Gradle catches this during checkReleaseDuplicateClasses and kills the build.
Error
Duplicate class com.google.android.gms.ads.AdError found in modules
ads-mobile-sdk-0.21.0-beta01.aar (com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk:0.21.0-beta01)
play-services-ads-api-24.6.0.aar (com.google.android.gms:play-services-ads-api:24.6.0)
(Same for ~50 other classes in com.google.android.gms.ads.* and com.google.android.gms.ads.mediation.*)
Environment
@clerk/expo: 3.1.6react-native-google-mobile-ads: 15.8.3- React Native: 0.81.5
- Expo SDK: 54
- Gradle: 8.14.3
- Build: EAS cloud (production profile)
Workaround
Excluding the transitive dependency via a config plugin works:
configurations.all {
exclude group: 'com.google.android.libraries.ads.mobile.sdk', module: 'ads-mobile-sdk'
}This keeps play-services-ads-api from the AdMob package and drops the beta ads-mobile-sdk from Clerk. Auth still works fine without it.
Expected behavior
clerk-android-ui shouldn't pull in Google's ads SDK as a transitive dependency. It's unrelated to authentication and creates conflicts for anyone using AdMob.
Ideally, clerk-android-ui should either exclude ads-mobile-sdk from its own dependencies, or pin a version that doesn't conflict with play-services-ads-api.