Integration help for Javascript

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.

Thanks it works now (just copied your whole structure to my project). Donā€™t know what the problem was in detail but Iā€™m glad that it works. :slight_smile:

Hi!I established sdkbox and now I get a screen emulator first, as it removed?