[SOLVED] SDKBox - Plugin com/sdkbox/plugin/SDKBoxIAPGooglePlay not found

I am getting this bug while trying to setup IAP SDKBox Plugin.
What I am missing?

I am using Android Studio and cocos2d-x v3.15

06-19 17:09:25.311 7737-8038/com.ironhidegames.android.kingdomrush4 D/IAP: creating Products list:
06-19 17:09:25.312 7737-8038/com.ironhidegames.android.kingdomrush4 I/SDKBOX_CORE: Initialization request for plugin: ‘com/sdkbox/plugin/SDKBoxIAPGooglePlay’
06-19 17:09:25.313 7737-8038/com.ironhidegames.android.kingdomrush4 E/SDKBOX_CORE: Plugin com/sdkbox/plugin/SDKBoxIAPGooglePlay not found.
06-19 17:09:25.313 7737-8038/com.ironhidegames.android.kingdomrush4 W/System.err: java.lang.ClassNotFoundException: com.sdkbox.plugin.SDKBoxIAPGooglePlay
06-19 17:09:25.314 7737-8038/com.ironhidegames.android.kingdomrush4 W/System.err: Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.sdkbox.plugin.SDKBoxIAPGooglePlay” on path: DexPathList[[zip file “/data/app/com.ironhidegames.android.kingdomrush4-1/base.apk”],nativeLibraryDirectories=[/data/app/com.ironhidegames.android.kingdomrush4-1/lib/arm, /system/fake-libs, /data/app/com.ironhidegames.android.kingdomrush4-1/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
06-19 17:09:25.315 7737-8038/com.ironhidegames.android.kingdomrush4 I/IAP: AndroidManifest has no store metadata. Defaulting to 'googleplay
06-19 17:09:25.315 7737-8038/com.ironhidegames.android.kingdomrush4 E/IAP: Can’t create IAP java object of type: ‘’.

Are you using 3.15 c++ project or js/lua projects?

C++

I am not at the office right now, but could this error be because of missing gps installation?

I did the manual installation and I think I missed this: http://docs.sdkbox.com/en/plugins/iap/v3-cpp/#manual-integration-for-google-play-services-sdk-dependent-library-only

En, you’re missing the PluginGooglePlay.jar jar file and the Google Play Services need to install.

Recommend the sdkbox command tool, doc here.

python -c "import urllib; s = urllib.urlopen('https://raw.githubusercontent.com/sdkbox-doc/en/master/install/install.py').read(); exec s"

then import a plugin is every easy, as:

sdkbox import iap

I’m sure that this PluginGooglePlay.jar file was copied.

We tried the command line installer but we prefer the manual installation at this time because we are trying to understand what sdkbox change in the project.

One thing we didn’t like about the command line tool was that it changed the mk file format in a very strange on.

Also it gives us an error message at the end.

I wil try it again tomorrow and post here the things we didn’t like it, maybe we made a mistake.

OK, we’ll improve the mk file format.

Update1:
And if I delete the PluginGooglePlay.jar file, and cocos run -p android -m release, I got error like yours:

          SDKBOX_CORE  I  Initialization request for plugin: 'com/sdkbox/plugin/SDKBoxIAPGooglePlay'
                         E  Plugin com/sdkbox/plugin/SDKBoxIAPGooglePlay not found.
             System.err  W  java.lang.ClassNotFoundException: com.sdkbox.plugin.SDKBoxIAPGooglePlay
                         W      at java.lang.Class.classForName(Native Method)
                         W      at java.lang.Class.forName(Class.java:308)
                         W      at java.lang.Class.forName(Class.java:272)
                         W      at com.sdkbox.plugin.SDKBox.initPlugin(Unknown Source)
                         W      at org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(Native Method)
                         W      at org.cocos2dx.lib.Cocos2dxRenderer.onSurfaceCreated(Unknown Source)
                         W      at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1548)
                         W      at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1286)
                         W  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.sdkbox.plugin.SDKBoxIAPGooglePlay" on path: DexPathList[[zip file "/data/app/org.cocos2dx.PluginTest-1/base.apk"],nativeLibraryDirectories=[/data/app/org.coco
                            s2dx.PluginTest-1/lib/arm, /vendor/lib, /system/lib]]
                         W      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                         W      at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                         W      at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                         W      ... 8 more
                         W      Suppressed: java.lang.ClassNotFoundException: com.sdkbox.plugin.SDKBoxIAPGooglePlay
                         W          at java.lang.Class.classForName(Native Method)
                         W          at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                         W          at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                         W          at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                         W          ... 9 more
                         W      Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Ok.
The docs said that I need to copy the jar files to this folder:
Android Studio: cocos2d/cocos/platform/android/libcocos2dx/libs

I have PluginGooglePlay.jar there along with PluginIAP.jar and sdkbox.jar
I don’t know what I am missing here but I keep getting the same error.

Also I am using android studio.

Can you please show me your Android.mk file? maybe there is something missing in my file to compile PluginGooglePlay.jar

Ok.
I think I found the problem.
The documentation said that If you are using Android Studio you should copy the files to this folder:

Android Studio: cocos2d/cocos/platform/android/libcocos2dx/libs

To fix the problem of missing file I copied the files to this folder (Android command line):

Android command-line: cocos2d/cocos/platform/android/java/libs

And now is working.

What is wrong here? the docs? or I am missing something?

I know, I know.

cocos2d-x modified the build.gradle:

dependencies {
    compile fileTree(dir: '../java/libs', include: ['*.jar'])
}

the …/java/libs folder is the issue.

sdkbox copy files to the both folders, so when using sdkbox command, everything works.

I’ll update the documentation.
Thank you for pointing out the problem.

Great!
So, the correct fix is to copy the files to both places?
I will do some test, maybe we should remove the jars from

Android Studio: cocos2d/cocos/platform/android/libcocos2dx/libs

It depends on your cocos2d-x version,

For you, just keep jar files in cocos2d/cocos/platform/android/java/libs .

Ok.
I was able to make a purchase :slight_smile: on both platforms, Google and Android.

I updated the subject to SOLVED, maybe it will help another dev with the same issue.

1 Like