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
SdkBoxPlay
SdkBoxIAP
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!!
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)
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.
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 >:(
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
sdkbox::PluginSdkboxPlay::init();
sdkbox::PluginSdkboxPlay::setListener(gPlayListener);
// 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
sdkbox::PluginSdkboxPlay::signin();
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.
UPDATE:
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)
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):