Integration help for Javascript

If you need help integrating SDKBOX with your Javascript app.

Hi guys, great work with SDKBOX! I manage to integrate sdkbox and chartboost for iOS without any issues.

However, I have a issue with integrating it android. More specifically, i am stuck at
-2.5 Modify project.properties

I was wondering if there is a better help page or documentation on adding a Google Play Services to my project? I am using Cocos IDE for most of the development. Do i have to open the project with eclipse to add the Google Play Services?

Let me ask @nite and @mannewalis to help here. I know this stye varies a bit for each person depending upon their setup.

We have a new release coming out tomorrow that I think will be helpful. There is new documentation along with it too.

run the Android SDK Manager (you can just type android at the command line if you are on a mac)

Scroll down to the bottom and open Extras.

Check google play services (and uncheck everything else) and install.

Then add this line in project.properties, changing YOUR_SDK to the path of your sdk.

android.library.reference.1=
  YOUR_SDK/extras/google/google_play_services/libproject/google-play-services_lib

FYI, Chartboost, does not need Google Play, the docs have been updated in the 1.0.1 release that will be out today.

Hi Guys,

I really fell in love with cocos2d-js and made a beautiful game.
To add some ads i wanted to use the all-new sdkbox with chartboost.
I downloaded it for cocos-js 3.0+ and followed the instructions to make things work on Android.
But in fact it doesn’t work at all, because of the missing .cpp files (In the doc nobody said i have to copy them anywhere).
I found out that there are the needed files in the zip/plugin/jsbindings but where i have to put them? :confused:
Building fails everytime because of missing files etc…
Hope you guys can help me…

Sure, the recommended place to put the js binding files are frameworks/runtime-src/Classes under your project folder

  • for xcode, make sure to drag&drop the files to xcode
  • with android project, make sure to add them in the Android.mk

New error incoming:

19:09:10 In file included from jni/../../Classes/SDKBoxJSHelper.cpp:1:0:
19:09:10 jni/../../Classes/SDKBoxJSHelper.h:6:5: error: 'JSBool' does not name a type
19:09:10      JSBool js_to_number(JSContext *cx, jsval v, double *dp);
19:09:10      ^
19:09:10 jni/../../Classes/SDKBoxJSHelper.cpp:5:5: error: 'JSBool' does not name a type
19:09:10      JSBool js_to_number(JSContext *cx, jsval v, double *dp)
19:09:10      ^

:confounded:

EDIT: Even after changig every JSBool to bool i couldn’t get this thing to work… It’s a mess, that the revolutionary SDKBOX doesn’t work. :cry:

Can you open a new post for this issue?

I need the following info from you to fix this issue
Which version of cocos2d-js are you using?
What’s the value of MOZJS_MAJOR_VERSION from your jsapi.h

Another problem coming up now:

ERR: Chartboost: Failed to get plugin config json

Where i have to put the json file?

sdkbox_config.json needs to go in res

Done that but the error in logcat is even there… I thought of the problem that in cocos-js all resources have to be preloaded…
So maybe I also have to pre-load the json file?
@nite @slackmoehrle

preload? I don’t think there should be a need for this. I can you show me what your resources folder looks like?

Also make sure you also updated Cocos2dxActivity.java according to the documentation. That could also cause this problem.

@nite double-checked and i edited it the way you said (zip attached)
@slackmoehrle ok. picture attached for you
Still not working^^

Cocos2dxActivity.zip (3.8 KB)

Your Cocos2dxActivity looks correct. Can you post your logcat error messages?

Here. It appears when I’m trying to display an ad.
I initialized chartboost by calling sdkbox.PluginChartboost.init(); in main.js

https://goo.gl/ZMFoDw

I created this sample project with chartboost js integration, can you give it a try?

Notice it will show more game by default, if you want it to show ads, you should change to show(“Default”)

Your version is working for me… @nite I’m trying to compare your version with my one to find the mistake… You have any ideas?

Since your version compiles and runs, most likely the error is in java side, also you should double check if there is any error in the json, run it through http://jsonlint.com/ maybe.