SDKBOXPLAY No implementation found for void com.sdkbox.plugin.SDKBox.nativeInit

Hi,

i’,m currently working on my first mobile game using cocos2d js.
But i encountered a problem using SDKBOXPLAY.

sdkbox version 1.0.3.0
sdkboxplay version 2.4.3.3
Cocos version 3.17.1
Test device Samsung 8 android-version 9

When i start my game it immediately crashes with the error message:
No implementation found for void com.sdkbox.plugin.SDKBox.nativeInit.

I have read multiple other threads about this problem with older version of SDKBOX.
But still couldn’t find the fix that works for me.

At this point i’m very lost on what to to next.
I’m happy to provide you with any necessary information.

  1. you can try staging version
  2. change PROP_BUILD_TYPE=cmake to PROP_BUILD_TYPE=ndk-build with frameworks/runtime-src/proj.android/gradle.properties file

Updated to staging version 2.4.3.9.
stil the same error:

java.lang.UnsatisfiedLinkError: No implementation found for void com.sdkbox.plugin.SDKBox.nativeInit(java.lang.Object, java.lang.ClassLoader) (tried Java_com_sdkbox_plugin_SDKBox_nativeInit and Java_com_sdkbox_plugin_SDKBox_nativeInit__Ljava_lang_Object_2Ljava_lang_ClassLoader_2)
at com.sdkbox.plugin.SDKBox.nativeInit(Native Method)
at com.sdkbox.plugin.SDKBox.init(SDKBox.java:71)
at com.sdkbox.plugin.SDKBoxActivity.onCreate(SDKBoxActivity.java:13)
at org.cocos2dx.javascript.AppActivity.onCreate(AppActivity.java:35)
at android.app.Activity.performCreate(Activity.java:7327)
at android.app.Activity.performCreate(Activity.java:7318)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3088)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3251)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7045)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

PROP_BUILD_TYPE already was on ndk-build

Some extra information:
my android.mk file
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := cocos2djs_shared

LOCAL_MODULE_FILENAME := libccjs

LOCAL_SRC_FILES := hellojavascript/main.cpp
…/…/…/Classes/AppDelegate.cpp
…/…/…/Classes/PluginSdkboxPlayJS.cpp
…/…/…/Classes/PluginSdkboxPlayJSHelper.cpp
…/…/…/Classes/SDKBoxJSHelper.cpp
LOCAL_WHOLE_STATIC_LIBRARIES := PluginSdkboxPlay
sdkbox

LOCAL_CPPFLAGS += -DSDKBOX_ENABLED
LOCAL_WHOLE_STATIC_LIBRARIES += android_native_app_glue
LOCAL_LDLIBS := -landroid
-llog

LOCAL_C_INCLUDES += $(LOCAL_PATH)/…/…/…/Classes

LOCAL_WHOLE_STATIC_LIBRARIES += PluginSdkboxPlay
LOCAL_WHOLE_STATIC_LIBRARIES += sdkbox
LOCAL_STATIC_LIBRARIES := ccjs_static

LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2
-DCOCOS2D_JAVASCRIPT

include $(BUILD_SHARED_LIBRARY)
$(call import-add-path,$(LOCAL_PATH))
$(call import-add-path, $(LOCAL_PATH)/…/…/…/…/cocos2d-x)
$(call import-module, android/native_app_glue)
$(call import-module, cocos/scripting/js-bindings/proj.android)
$(call import-module, ./sdkbox)
$(call import-module, ./PluginSdkboxPlay)

My Application.mk file:
APP_STL := c++_static

APP_CPPFLAGS := -frtti
-DCC_ENABLE_CHIPMUNK_INTEGRATION=1
-std=c++11
-fsigned-char
-Wno-extern-c-compat
APP_LDFLAGS := -latomic

APP_ABI := armeabi-v7a
APP_SHORT_COMMANDS := true

USE_ARM_MODE := 1

ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
else
APP_CPPFLAGS += -DNDEBUG
APP_OPTIM := release
endif
APP_PLATFORM := android-10

no effect:

I get the solution with the latest console:

cocos compile -p android --build-type ndk-build

Thanks,

When i run the compile command like:

cocos compile -p android --build-type ndk-build

i get the following error when native_app_glue is present in the Andriod.mk file:
…/sources/android/native_app_glue/android_native_app_glue.c:233: error: undefined reference to ‘android_main’

When i remove android_native_app_glue from the Andriod.mk file everything compliles again but still encountering the java.lang.UnsatisfiedLinkError: No implementation found for void com.sdkbox.plugin.SDKBox.nativeInit error.

Adding android_native_app_glue to the Andriod.mk file is one of the manual tutorial steps for andriod.
Is the implementation of native_app_glue mandatory for sdkbox to run?

should be

LOCAL_SRC_FILES := hellojavascript/main.cpp \
…/…/…/Classes/AppDelegate.cpp \
…/…/…/Classes/PluginSdkboxPlayJS.cpp \
…/…/…/Classes/PluginSdkboxPlayJSHelper.cpp \
…/…/…/Classes/SDKBoxJSHelper.cpp

or could you plz share your test project with me ?

I double checked my Android.mk file, it seems the \ are present in my file.
Which method can i use best the share my project with you?

email, github, gitlab all are ok.

Pushed my test project to github.

I’m checking your project.

1. check

cocos compile -p android --build-type ndk-build

2. Solution

git diff frameworks/runtime-src/proj.android/app/AndroidManifest.xml
diff --git a/test/frameworks/runtime-src/proj.android/app/AndroidManifest.xml b/test/frameworks/runtime-src/proj.android/app/AndroidManifest.xml
index 2ea4f98..ff792aa 100644
--- a/test/frameworks/runtime-src/proj.android/app/AndroidManifest.xml
+++ b/test/frameworks/runtime-src/proj.android/app/AndroidManifest.xml
@@ -2,7 +2,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.sdkbox" android:installLocation="auto">
     <uses-feature android:glEsVersion="0x00020000" />
     <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name">
-        <meta-data android:name="android.app.lib_name" android:value="cocos2djs" />
+        <meta-data android:name="android.app.lib_name" android:value="ccjs" />
         <activity android:configChanges="orientation|keyboardHidden|screenSize" android:label="@string/app_name" android:launchMode="singleTask" android:name="org.cocos2dx.javascript.AppActivity" android:screenOrientation="landscape" android:taskAffinity="" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -20,4 +20,4 @@
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
     <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-</manifest>
\ No newline at end of file
+</manifest>

now, it launches without any crash.

how do you create the project and which cocos2d-js version do you use, github master ?

i created the project using:

cocos new <game name> -p <package identifier> -l <language> -d <location>

with cocos2djs version 3.17.1.

compiling using the following works just fine:

cocos compile -p android --build-type ndk-build

When i change the android.app.lib_name to ccjs i’m getting the same error you first described but with the libccjs.so file

    java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.test.sdkbox-c-813BolEaMsLL5LBM8AZg==/base.apk"],nativeLibraryDirectories=[/data/app/com.test.sdkbox-c-813BolEaMsLL5LBM8AZg==/lib/arm, /data/app/com.test.sdkbox-c-813BolEaMsLL5LBM8AZg==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]] couldn't find "libccjs.so"
        at java.lang.Runtime.loadLibrary0(Runtime.java:1012)
        at java.lang.System.loadLibrary(System.java:1669)
        at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:116)
        at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:142)
        at com.sdkbox.plugin.SDKBoxActivity.onCreate(SDKBoxActivity.java:11)
        at org.cocos2dx.javascript.AppActivity.onCreate(AppActivity.java:35)
        at android.app.Activity.performCreate(Activity.java:7327)
        at android.app.Activity.performCreate(Activity.java:7318)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3088)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3251)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7045)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

am i missing something still?

modify frameworks/runtime-src/proj.android/app/AndroidManifest.xml

replace cocos2djs with ccjs


if you want to check with latest v3 branch, need some fixing with gradle settings

Found out what i was doing wrong all this time :smiley:

It seems when using --build-type ndk-build when compiling

cocos compile -p android --build-type ndk-build

You also need to use --build-type ndk-build to run the project

cocos run -p android --build-type ndk-build

If not cmake is used by default.

Thank you very much jimmy for all your feedback on such short notice.