[SDKBOX] sdkboxplay android init crash

[SDKBOX] sdkboxplay android init crash
0.0 0



I got an issue with building an android verion. (iOS version works fine)

  • Here are the version i am using.
    cocos2d-x 3.8.1
    sdkbox just updated
    ndk r10e

  • Using features

  • Error
    sdkbox: init native fail - this is from “sdkbox::PluginSdkboxPlay::init();”
    (error codes: JNI DETECTED ERROR IN APPLICATION: JNI NewStringUTF called with pending exception ‘java.lang.NoClassDefFoundError’ thrown in unknown throw location’app’ A/art: art/runtime/check_jni.cc:65] in call to NewStringUTF)
    crashes when “sdkbox::PluginSdkboxPlay::init();” is called.

How to reproduce?
1.create new project.
2.sdkbox import sdkboxplay
3.cocos compile android-studio
4.run it on AndroidStudio
5. crash!!

Does anyone have any idea?



Add com.android.support:support-v4:23.1.1 dependancy in Dependancies tab on Open Module Setting.


Thanks we’ll update the documentation to mention the required android libraries.


My app is also crashing in this exact same way. I am not using Android Studio (simply deploying to device). How do I implement this fix?

cocos2d-x 3.10
sdkbox - latest
ndk r11c


I can add one other bit of information. The logcat output contains the following:

I/SDKBOX_CORE(31543): Initialization request for plugin: ‘com/sdkbox/plugin/SDKBoxIAPGooglePlay’
W/System.err(31543): at com.sdkbox.plugin.SDKBoxIAPGooglePlay.initIAP(SDKBoxIAPGooglePlay.java:136)
I/SDKBOX_CORE(31543): Initialization request for plugin: ‘com/sdkbox/plugin/PluginSdkboxPlay’
E/sdkboxplay(31543): init native fail


Can you double check the sdkbox_config.json are correct?


Yes, there is only one leaderboard, and its id is correct. I tried building for android-19 (previously 15) and it’s still crashing. I created 5 achievements on google play dev (because google forces you, for some reason) but I didn’t include them in the JSON file because I’m not actually planning on using them. I can try including them and seeing what happens.

EDIT: Added the achievements…still crashing as before.
EDIT2: Tried setting debug to “true” in sdkbox_config.json (under “sdkboxplay”) and unfortunately it’s still crashing and the same debug output is given (as I listed previously)


First try clear project, without sdkbox. If works, copy android-support-v4.jar to proj.android\libs and add sdkbox.


So the error message you send is from IAP, I suspect you have a empty section of IAP in sdkbox_config.json, can you double check?


I don’t think it’s coming from IAP (that seems to be just an unfortunate naming problem). The sdkbox::IAP code seems to be working ok so far. The crash was happening when calling sdkbox::PluginSdkboxPlay::init().

So, after downloading/updating all Android SDKs and manually updating the sdkbox plugins (IAP and PluginSdkboxPlay), I’ve managed to get the app to run. However…

I have in cocos/platform/android/java/libs…
PluginGooglePlay.jar from sdkbox-iap_v2.2.3.1 [61,325 bytes]
PluginIAP.jar from sdkbox-iap_v2.2.3.1 [752 bytes]
PluginSdkboxPlay.jar from sdkbox-sdkboxplay_v2.2.3.1 [20,184 bytes]
android-support-v4.jar from the latest android sdks [1,422,188 bytes]

If I use sdkbox.jar from sdkbox-iap_v2.2.2.12 [72,479 bytes] the app will run, but PluginSdkboxPlay::signin() fails silently - no calls in to the listenter

If I use sdkbox.jar from sdkbox-iap_v2.2.3.1 [76,624 bytes] the app crashes when calling PluginSdkboxPlay::signin()

My app is beta published and linked with a published game services.
I have a “games-ids.xml” in proj.android/res/values with the app_id from game services.

Thanks very much for the help so far.


Some more fun info:

I was reading the manual integration for in-app and I realized I may be missing some dependancies…


was not in my project.properties. I went to the sdk folder to find this, and it was missing from the Android SDK. google_play_services was there, but not the sub folder libproject/google-play-services_lib. I did some searching, and it seems it might be packed inside the /extras/m2repository/com/google/android/gms or something. I’ll keep searching for info, but I have zero love for android development right now >:(


Please don’t use version yet, it’s a development build we’re still actively testing…


Thanks for the reply. I reverted all libraries to v2.2.2.12 (both cocos/platform/android/java/libs and proj.android/jni).

// The following executes with no problems

// logcat shows
I/SDKBOX_CORE(15526): Initialization request for plugin: ‘com/sdkbox/plugin/SDKBoxIAPGooglePlay’
I/SDKBOX_CORE(15526): Initialization request for plugin: ‘com/sdkbox/plugin/PluginSdkboxPlay’

// A little later I call

The game then crashes. No other logcat messages, and my listener is never called.

If there is anything else I can try, please let me know.

I managed to get the project running in Android Studio and this is the log after it crashed:

06-08 10:22:37.440 15984-15984/com.mycompany.mygame D/AndroidRuntime: Shutting down VM
06-08 10:22:37.440 15984-15984/com.mycompany.mygame W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x4176fc08)
06-08 10:22:37.440 15984-15984/com.mycompany.mygame E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mycompany.mygame, PID: 15984
java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
at com.google.android.gms.common.internal.zzj$zza.zzc(Unknown Source)
at com.google.android.gms.common.internal.zzj$zza.zzv(Unknown Source)
at com.google.android.gms.common.internal.zzj$zzc.zzqx(Unknown Source)
at com.google.android.gms.common.internal.zzj$zzb.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)

Sorry if this isn’t very helpful


Is there a way that I can get your project or a sample project to take a look? Looks like it’s missing some files


I have finally made progress, the game is no longer crashing. SDKBOX may need to updated with this information.

I discovered the following in logcat:
E/ValidateServiceOp(31373): Using Google Play games services requires a metadata tag with the name “com.google.android.gms.games.APP_ID” in the application tag of the manifest for com.mycompany.mygame

Did some research and added the following to the manifest file (inside the application tag):
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" /> (value ‘app_id’ located in strings.xml or another xml file in that folder)

The sdkbox tool creates the following line in the manifest file (I removed this when I added the previous tag):

<meta-data android:name="google_app_id" android:value="my_app_id" />

I hope this helps. We can call this solved.

for reference:


Thanks for the update, we’ll look into this issue, and release a fix in our next version



Sorry but i have the same issue with sdkboxplay v2.3.8.5

App crashes when I call sdkbox::PluginSdkboxPlay::init();

This is what logcat show:

p/s: Im using cocos2dx 3.10, ndk-r10e, and latest android sdk.

@nite Can you help me please?


It looks like the sdkbox.jar is a old version, can you double check?


Thanks nite for replying. I figured out that I forgot to add google play services lib to my project.