Simulator: 406:ReferenceError: sdkbox is not defined

Hi,

I am using cocos creator and sdkbox and it seems I can’t make the admob banner ads appear on my app.

I added on my main game js this line of code

if (cc.sys.isMobile) {
sdkbox.PluginAdMob.init();
}

but I’m hitting this error message > Simulator: 406:ReferenceError: sdkbox is not defined.

I tested both on simulator and an actual device.

I already setup my admob account and everything.

Am I missing something?

Thank you very much in advance for your time.

Cheers!

Have you follow the integration documentation
http://docs.sdkbox.com/en/qa/integration-admob-to-creator/

1 Like

Hi nite,

Thank you for your response. I followed the documentation and everything was fine. However, after I clicked the Cache/Show button I’m hitting the same error message as seen below

Simulator: 29:ReferenceError: sdkbox is not defined
at a (E:\AdmobTest\library\bundle.project.js?009:NaN:0)

I’m running on android and I’m not sure if it’s an issue since the documentation you provided was for ios.

Update #1:
On top of sdkbox is not defined it seems that the admobInit was not being called for some reasons.

Update #2:
The same issue persist on both windows and mac version of cocos creator v 1.3.1

Hoping to hear from you soon. Thank you.

I updated the documentation based on your feedback, adding android build

http://docs.sdkbox.com/en/qa/integration-admob-to-creator/

I think the error you’re experiencing is because sdbox not been installed to your android project, maybe some steps is performed out of order, you have to build android project first before import sdkbox plugin.

1 Like

Hi nite,

I followed your updated documentation and it works like a charm. Thank you.

In addition to that, I added these codes below

onLoad: function() {
  if (cc.sys.isMobile) {
    this.admobInit();
  }
},

since it was not working on the simulator/browser but was working perfectly on the actual mobile device.
I was testing it on the simulator first and it was giving me an impression that it doesn’t work however once I deployed the app to the device, it has no issues.

Thank you very much for your help.

1 Like

Hello, i followed everything, when i build, compile and run on device, my app just goes to a black screen for 2 secs and close. Can i know what may be the problem please, this is frustrating me days now,

Thanks in advance

Can you create a new thread with your issue, also please attach your logcat logs, this will help us solve the issue.