[FIXED] SDKBOX IAP Plugin crash

I am using r10e (64-bit).

I am trying to make Android version of SDKBox IAP work. Sadly, it is not working for me. I made a button to call sdkbox::IAP::purchase(“ItemName”); When I click the button, nothing happens. When I click a few more times, it crashes. I do not know what is the problem.

I cant get much information from LogCat as well

threadid=3: reacting to signal 3
Wrote stack traces to ‘/data/anr/traces.txt’
Fatal signal 6 (SIGABRT) at 0x000002ac (code=0), thread 11697 (xxx)

Same project works like a charm on iOS

Can you first clear the log using

adb logcat -c

Then you can attached the full log here, I’ll help you find out what’s going on.

Just give an update, I’m still trying to setup the same environment as you have and try reproduce this crash.

You can use ndk-stack to find out the reason behind a crash:
https://developer.android.com/ndk/guides/ndk-stack.html

You can specify /proj.android/obj/local/armeabi as the path for -sym.

It is working now for some reason. I believe it did not add the library files properly the first time.

I wasn’t able to reproduce the crash with ndk r10e and cocos2d-x 3.6 and our latest 1.1.6 version

So I uploaded my sample here

Please give it a try and let me know what kind of error you encounter.

Version 1.1.6.5 is working perfectly for me now. Good job with the fix, whatever that was. :smiley:

:smiley: Fixed!, thanks a lot.

SDKBOX team repeating same misstake as other Plugin developers for Cocos2d-x:

PLEASE UPDATE DOCUMENTATION TO RECENT VERSION!!!

so there is FIX for IAP documentation, according to our working code changes can be made in AppActivity.java also!

Instead of:

LOCAL_STATIC_LIBRARIES += PluginIAP
LOCAL_STATIC_LIBRARIES += sdkbox

you should put to Android.mk

LOCAL_WHOLE_STATIC_LIBRARIES += PluginIAP 
LOCAL_WHOLE_STATIC_LIBRARIES += sdkbox

To initialize IAP use:

   sdkbox::IAP::init();

instead of

     sdkbox::PluginIAP::init();

I looked at the online docs and I don’t see the mistakes you are referring to.

I looked at the PDF, which is generated from Markdown and I don’t see these items.

Then I downloaded the plugin from the website and I do see it in the PDF there. It seems we never updated this with the bundle. I will get it updated. Thank you for talking about this.

That great! Didnt noticed that sdkbox have online documentation, so you need to make it somewhere more higlighted.

We are starting to promote the online docs. I think in the next release we will be replacing the PDF’s with a link to the online docs. Again I apologize that the PDF’s did not get updated. It will be taken care of.

I have same error with latest versions of sdk box

E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.UnsatisfiedLinkError: Native method not found: com.sdkbox.plugin.SDKBox.nativeSetAssetManager:(Landroid/content/Context;Landroid/content/res/AssetManager;)V
at com.sdkbox.plugin.SDKBox.nativeSetAssetManager(Native Method)
at com.sdkbox.plugin.SDKBox.init(SDKBox.java:61)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:225)
at android.app.Activity.performCreate(Activity.java:5372)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2359)
at android.app.ActivityThread.access$700(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5455)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
at dalvik.system.NativeStart.main(Native Method)

and LOCAL_WHOLE_STATIC_LIBRARIES did’t help

@stehan so you are using version 1.2.1?

Can you double check if you updated the Cocos2dxActivity.java file according to documentation?
http://sdkbox-doc.github.io/en/plugins/iap/v3-cpp/

nothing wrong with Cocos2dxActivity.java
the thing is, if i use sdkbox installer, i have this error, and often another unexpected crash.
but if i add everything manually to android.mk, manifest, etc., everything works fine. I’m using Android studio + gradle + cocos2d from sources.

yes. latest version of sdkbox

Ok, we’re adding the manual steps to our online documentation, we’ll also trying to fix the automatic installation experience.