I used react-native-admob 2.0.0-beta.5 in older version of my app but now when I run react-native run-android it gave me this error:
FAILURE: Build failed with an exception.
Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: com.google.android.gms.common.api.internal.zzd
I test my other packages but when I link react-native-admob it shows this error!!
after some searching, i understand that yesterday Google October 2nd, 2018 updates some libraries that caused this error i changed android/build.gradle file :
compile 'com.google.android.gms:play-services-ads:+'
to
compile 'com.google.android.gms:play-services-ads:15.0.0'
and problem SOLVED
compile 'com.google.android.gms:play-services-ads:15.0.0'
saved my life >.<
If you are like me and can't / don't want to edit your node_modules directly, you edit your app/build.gradle to look like this:
dependencies {
implementation (project(':react-native-admob')) {
exclude group: 'com.google.android.gms', module: 'play-services-ads'
}
implementation 'com.google.android.gms:play-services-ads:15.0.0'
}
This is basically the same thing @PuriaGithub suggests, but won't break your CI/CD pipelines.
@PuriaGithub
Thanks Man. You are the champ for the day for me.
I have tried, but I still get the same error :(
@NySiya Which build.gradle did you edit for that?
I have gotten it the error work now. But Banner doesn't show up. I don't know why? @marhaupe
@marhaupe Thank you so so much <3
Most helpful comment
after some searching, i understand that yesterday Google October 2nd, 2018 updates some libraries that caused this error i changed android/build.gradle file :
compile 'com.google.android.gms:play-services-ads:+'
to
compile 'com.google.android.gms:play-services-ads:15.0.0'
and problem SOLVED