I am using Cocos2D-X 3.13.1 (Linux) and the SDKBOX AdMob integration (installed via sdkbox import admob
).
In my class, I have the following code (MainMenuScene
inherits cocos2d::LayerColor
):
bool MainMenuScene::init() {
if(!Layer::init()) {
return false;
}
if(!LayerColor::initWithColor(Color4B(255, 255, 255, 255))) {
return false;
}
#ifdef SDKBOX_ENABLED
CCLOG("CCLog: (Ads) Caching mainmenu.");
sdkbox::PluginAdMob::cache("mainmenu");
CCLOG("CCLog: (Ads) Showing mainmenu.");
sdkbox::PluginAdMob::show("mainmenu");
#else
CCLOG("CCLog: (Ads) Not enabled.");
#endif
...
However, the banner advertisements (my only ad type) are not displaying at all.
Logcat reveals the following:
11-07 22:04:09.285 27743 27743 D DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
11-07 22:04:09.363 27743 27770 D cocos2d-x debug info: CCLog: (Ads) Caching mainmenu.
11-07 22:04:09.363 27743 27770 D cocos2d-x debug info: CCLog: (Ads) Showing mainmenu.
11-07 22:04:09.585 27743 27743 I Ads : Starting ad request.
11-07 22:04:09.587 27743 27743 I Ads : Use AdRequest.Builder.addTestDevice("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") to get test ads on this device.
11-07 22:04:09.626 27743 27743 D DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
11-07 22:04:09.628 27743 27743 I Ads : Starting ad request.
11-07 22:04:09.628 27743 27743 I Ads : Use AdRequest.Builder.addTestDevice("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") to get test ads on this device.
11-07 22:04:09.632 27743 27823 D hg : at com.google.android.gms.ads.internal.y.a(:com.google.android.gms.DynamiteModulesA:3106)
11-07 22:04:09.632 27743 27823 D hg : at com.google.android.gms.ads.internal.request.c.a(:com.google.android.gms.DynamiteModulesA:144)
11-07 22:04:09.632 27743 27823 D hg : at com.google.android.gms.ads.internal.util.b.run(:com.google.android.gms.DynamiteModulesA:19)
11-07 22:04:09.632 27743 27823 D hg : at com.google.android.gms.ads.internal.util.y.call(:com.google.android.gms.DynamiteModulesA:1055)
11-07 22:04:09.632 27743 27823 D hg : at com.google.android.gms.ads.internal.util.z.run(:com.google.android.gms.DynamiteModulesA:75)
11-07 22:04:12.057 27743 27743 I Ads : Scheduling ad refresh 30000 milliseconds from now.
11-07 22:04:12.092 27743 27743 I Ads : Ad finished loading.
11-07 22:04:12.146 27743 27743 I chromium: [INFO:CONSOLE(0)] "Document was loaded from Application Cache with manifest https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.appcache", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
11-07 22:04:12.146 27743 27743 I chromium: [INFO:CONSOLE(0)] "Application Cache Checking event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
11-07 22:04:12.367 27743 27743 I chromium: [INFO:CONSOLE(0)] "Application Cache NoUpdate event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
11-07 22:04:42.067 27743 27743 I Ads : Ad is not visible. Not refreshing ad.
11-07 22:04:42.067 27743 27743 I Ads : Scheduling ad refresh 60000 milliseconds from now.
11-07 22:05:09.610 27743 27743 W Ads : Timed out waiting for ad response.
11-07 22:05:09.610 27743 27743 I Ads : Scheduling ad refresh 60000 milliseconds from now.
11-07 22:05:09.610 27743 27743 W Ads : Failed to load ad: 2
11-07 22:05:42.068 27743 27743 I Ads : Ad is not visible. Not refreshing ad.
11-07 22:05:42.068 27743 27743 I Ads : Scheduling ad refresh 60000 milliseconds from now.
11-07 22:06:09.610 27743 27743 I Ads : Ad is not visible. Not refreshing ad.
11-07 22:06:09.610 27743 27743 I Ads : Scheduling ad refresh 60000 milliseconds from now.
11-07 22:06:42.068 27743 27743 I Ads : Ad is not visible. Not refreshing ad.
11-07 22:06:42.068 27743 27743 I Ads : Scheduling ad refresh 60000 milliseconds from now.
I noticed Failed to load ad: 2
, however the internet (StackOverflow) indicates that this is due to AdMob being unable to connect to the internet. I have internet permissions in my AndroidManifest.xml
file, and do not have an adblocker installed. Other apps (that aren’t my creation) work well. There are no SDKBOX errors in the log, either.
I should note, in AdMob app settings, I have scheduled the advertisement to refresh every 30 seconds, even though it only mentions that once in the log (all other times mentioning 60 seconds for some reason).
I have tried looking at the provided sample code, however it seems out of date . Targeting armeabi-4.8
, whereas the latest is armeabi-4.9
. As 4.8
is hardcoded in the Python scripts, manually changing it to 4.9
works. However, a linking error occurs in libcocos2dxinternal.a
complaining about bzero()
not being able to be found.
I’m at a loss. Please help. Thank you.
Also posted to: http://www.sdkbox.com/answers/question/admobc-advertisements-are-not-showing/