Chartboost plugin does not work

Hi. I have implemented sdkbox and chartboost plugin manually.
If I run on ios, it is fine.
However I run on android, application is not crush but it doesn’t work.
I got such stack trace on android monitor.

09-07 17:23:53.663: V/WindowManager(754): Adding window Window{124ebdcf u0 com.oke_ya.witch/org.cocos2dx.cpp.AppActivity} at 8 of 15 (before Window{1516bb00 u0 Starting com.oke_ya.witch})
09-07 17:23:53.750: V/WindowManager(754): Adding window Window{2f547665 u0 SurfaceView} at 8 of 16 (before Window{124ebdcf u0 com.oke_ya.witch/org.cocos2dx.cpp.AppActivity})
09-07 17:23:53.807: A/libc(25168): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 25196 (GLThread 2394)
09-07 17:23:53.908: I/DEBUG(186): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-07 17:23:53.909: I/DEBUG(186): Build fingerprint: ‘google/hammerhead/hammerhead:5.1.1/LMY48I/2074855:user/release-keys’
09-07 17:23:53.909: I/DEBUG(186): Revision: ‘11’
09-07 17:23:53.909: I/DEBUG(186): ABI: ‘arm’
09-07 17:23:53.909: I/DEBUG(186): pid: 25168, tid: 25196, name: GLThread 2394 >>> com.oke_ya.witch <<<
09-07 17:23:53.909: I/DEBUG(186): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
09-07 17:23:53.937: I/DEBUG(186): r0 00000000 r1 a2c2d5f6 r2 00000000 r3 a2f60f30
09-07 17:23:53.937: I/DEBUG(186): r4 a2f60f2c r5 a2c2d5f6 r6 af22b778 r7 a2c2d5f6
09-07 17:23:53.937: I/DEBUG(186): r8 b6eacdf4 r9 a2c2d618 sl a2c2e043 fp af22ba14
09-07 17:23:53.937: I/DEBUG(186): ip 80000000 sp af22b718 lr a20dad33 pc a20dac32 cpsr 400f0030
09-07 17:23:53.938: I/DEBUG(186): backtrace:
09-07 17:23:53.938: I/DEBUG(186): #00 pc 009aec32 /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (sdkbox::JNIUtils::__getEnvAttach()+17)
09-07 17:23:53.938: I/DEBUG(186): #01 pc 009aed2f /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (sdkbox::JNIUtils::GetClassObjectFromName(char const*)+6)
09-07 17:23:53.944: I/DEBUG(186): #02 pc 009af36f /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (sdkbox::JNIUtils::GetJNIStaticMethodInfo(char const*, char const*, char const*)+14)
09-07 17:23:53.944: I/DEBUG(186): #03 pc 009af6a5 /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (void sdkbox::JNIInvokeStatic<void, std::string, std::function<void (std::string, _jobject*)>>(char const, char const*, std::string, std::function<void (std::string, _jobject*)>)+28)
09-07 17:23:53.945: I/DEBUG(186): #04 pc 009af76d /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (sdkbox::NativeBridge::AddEventListener(std::string const&, std::function<void (std::string, _jobject
)>*)+28)
09-07 17:23:53.945: I/DEBUG(186): #05 pc 009adf9b /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (sdkbox::RequestManagerAndroid::RequestManagerAndroid()+198)
09-07 17:23:53.945: I/DEBUG(186): #06 pc 009ae053 /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (sdkbox::SdkboxCore::__platformInit()+26)
09-07 17:23:53.945: I/DEBUG(186): #07 pc 009a696d /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (sdkbox::SdkboxCore::SdkboxCore()+40)
09-07 17:23:53.945: I/DEBUG(186): #08 pc 009a6d13 /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (sdkbox::SdkboxCore::getInstance()+22)
09-07 17:23:53.945: I/DEBUG(186): #09 pc 009a1a11 /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (sdkbox::ChartboostWrapper::init()+16)
09-07 17:23:53.946: I/DEBUG(186): #10 pc 009a202b /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (sdkbox::PluginChartboost::init()+6)
09-07 17:23:53.946: I/DEBUG(186): #11 pc 007a787c /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (AppDelegate::applicationDidFinishLaunching()+40)
09-07 17:23:53.946: I/DEBUG(186): #12 pc 009b0e0c /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (cocos2d::Application::run()+40)
09-07 17:23:53.946: I/DEBUG(186): #13 pc 009b3e80 /data/app/com.oke_ya.witch-1/lib/arm/libcocos2dcpp.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit+224)
09-07 17:23:53.946: I/DEBUG(186): #14 pc 00228295 /data/dalvik-cache/arm/data@app@com.oke_ya.witch-1@base.apk@classes.dex

thanks.

Thanks. Let us ask @nite to take a look at this.

I installed the facebook plugin through sdkbox v0.5.6.20 tonight and I see almost exactly the same error. When calling sdkbox::FacebookWrapper::init(), this is seen in the log:

F/libc: Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)

(sdkbox::JNIUtils::__getEnvAttach() is #00 in the backtrace)

I have:
cocos2d-x 3.8 release
facebook v1.2.3.3
tested with a few different Android 4.x versions, both emulators and one real device

Can you try this sample project and see if it works on your device?
https://github.com/darkdukey/sdkbox-facebook-sample

After some minor tweaking (fixed Application.mk mess and PluginFacebook.h inclusions), the sample project works fine on both emulators and devices.

The sample project appears to be using cocos2d-x 3.7-final and sdkbox 1.2.3.1, so apparently those are ok together.

I just tested with cocos2d-x 3.8-final and sdkbox 1.2.3.1 and it did not work.

1 Like

Thanks a lot, I’ll test it and make sure it works with 3.8

tested OK: cocos2d-x 3.7.1 with sdkbox 1.2.3.3

it is getting more and more clear that the problem is with 3.8

we’ll use 3.7.1 for now.

Please check Cocos2dxActivity.java file:

Make sure has this SDKBox.init(this); line

Example:

    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        CocosPlayClient.init(this, false);

        onLoadNativeLibraries();

        SDKBox.init(this);
1 Like

It works after adding SDKBox.init(this); to either Cocos2dxActivity.java or AppActivity.java

So thanks. This is not documented, right? I guess the sdkbox utility should update AppActivity.java automatically?

http://sdkbox-doc.github.io/en/plugins/chartboost/v3-cpp/

sdkbox has tips:

failed to patch file Cocos2dxActivity.java
failed to patch file AppDelegate.cpp
Please reference the online documentation to finish the integration:
http://sdkbox-doc.github.io/en/plugins/chartboost/v3-cpp/
Installation Successful :)
1 Like
failed to patch file Cocos2dxActivity.java

This does not appear when I use the sdkbox utility. It just fails silently.

Hmm, we might need some kind of command to help developer verify their sdkbox install.
Something like sdkbox doctor

2 Likes

In my case, this:

failed to patch file Cocos2dxActivity.java

or a note here http://blog.cocos2d-x.org/2015/08/getting-started-with-the-sdkbox-facebook-plugin/ would have been helpful.

This fixed my bugs.
Thanks