SDKBOX AdMob + Google Play Service

Hi, I’ve been trying to set up AdMob videos but I only have them working on iOS, still haven’t been able to make it work on Android.

It first crashed becase a Java class was failing, which apparently was due to an older version of GPS, this is the error:

11-25 20:18:00.367 23834-23834/com.robot.squad.puzzle.game D/AdMob: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/rewarded/RewardedAd;

I updated it to the latest version and now it compiles, but it crashes when calling:

sdkbox::PluginAdMob::init();
sdkbox::PluginAdMob::cache("shop_coins");

NOTE: this works on iOS, so the video name is correct.

Does anyone know what Google Play Service I need for AbMob plugin 2.5.0.5???

dependencies { compile 'com.google.android.gms:play-services-ads:17.2.0' }

how do you integrate AdMob plugin ?

When I add that to my build file I get this:

Error: Program type already present: com.google.ads.AdRequest

I am importing all libs using sdkbox CLI, and then the gps project from my libs folders. This is how is set up:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(':libcocos2dx')
    implementation project(':gps')

    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
    implementation 'com.crashlytics.sdk.android:crashlytics-ndk:2.0.2'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.billingclient:billing:2.0.1'
    implementation 'com.google.android.gms:play-services-ads:17.2.0'
}

Other plugins I have imported are: IAP, AdColony, Firebase and OneSignal, SdkboxPlay, SdkboxAds, Charboost and UnityAds.

After deleting manually the last 4, I now have IAP, AdColony, AdMob, Firebase and OneSignal and I get this error:

Error: Program type already present: com.google.android.gms.ads.internal.overlay.zza

Any thoughts? all other plugins are working in both platforms, and as I said before, AdMob also works on iOS… Thanks for the help!

UPDATE: found some posts about people having libs versions mismatch when using either Firebase or OneSignal, could that be the reason? how can I check to be sure? and how can be fixed if that is the problem?

This crash happens when I remove the following line:

    implementation project(':gps')

This is the crash:

you don’t need it. plz remove it and rebuild.

whats your engine version?

Sorry for my late reply, I’ve been on holidays…
Cocos version is 3.16.
I have removed the :gps project and now the crash is gone but I ahve 2 new problems:

  1. videos are still not showing. I’m getting an error: Ad failed to load : 0
    UPDATE: I’ve just seen my first AdMob test ad! It could have been that needed some time to load the videos (around 1 hour)… I will keep testing and mark this post as SOLVED once I’m sure it’s working :slight_smile: Thanks again!

  2. IAP have stopped working
    UPDATE: I had removed the billing dependency by mistake… seems to be working again by adding:

    implementation 'com.android.billingclient:billing:2.0.1'

Any help will be much appreciated. Thanks again!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.