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 org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:269)
at android.app.Activity.performCreate(Activity.java:6876)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
In my Application.mk, I am using:
APP_STL := c++_static
(Using gnustl_static is not an option, because many C++11 features that my code uses are missing with gnustl_static.)
I used the SDKBox libs from the android/jni/sdkbox/libs_c++_static folder to match.
I found this earlier forum post:
But that discussion does not seem to resolve the issue.
There is missing instruction in which you need to copy sdkbox_config.json file to build/jsb-default/frameworks/runtime-src/proj.android-studio/app/assets/res folder. With iOS you just need sdkbox_config.json in build/jsb-default/res folder
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)
From this it seems Java can’t find SDKBOX Java function or C++ function which is called from Java - check if all JAR’s are included into project and all C++ files was properly placed from static folder and is included in Android.mk - also before compile delete obj and libs folder in app folder to fully recompile project.
I’m mostly using cocos2d-x C++ version and your Android.mk looks like very much customised - starting from lib names and source file location in src folder. It could be issue if u modified it.
Best way to try out is to create helloworld project and import there SDKBOX plugin to test - to see if there is any issue with your environment configuration or wrongly configured current project if hello world works.
BTW: LOCAL_ARM_MODE := arm
Maybe this line is issue? according to google this parameter specify target ABI compile - as I remeber SDKBOX don’t have source files for ARM so it could be that why it can’t find this classes.
Thanks for your advice. After moving the LOCAL_WHOLE_STATIC_LIBRARIES lines above the LOCAL_STATIC_LIBRARIES, the build fails with these linker errors:
[armeabi-v7a] SharedLibrary : libTest.so
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4448: error: undefined reference to 'std::__1::__shared_weak_count::__release_shared()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4448: error: undefined reference to 'std::__1::__shared_weak_count::__release_shared()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:479: error: undefined reference to 'std::__1::ios_base::getloc() const'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:174: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:479: error: undefined reference to 'std::__1::locale::~locale()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::ios_base::getloc() const'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:174: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::locale::~locale()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:494: error: undefined reference to 'std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::id'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:494: error: undefined reference to 'std::__1::ctype<char>::id'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:508: error: undefined reference to 'std::__1::ios_base::getloc() const'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:174: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:508: error: undefined reference to 'std::__1::locale::~locale()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::ios_base::getloc() const'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:174: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::locale::~locale()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:520: error: undefined reference to 'std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::id'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:520: error: undefined reference to 'std::__1::ctype<char>::id'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:668: error: undefined reference to 'std::__1::ios_base::init(void*)'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/streambuf:370: error: undefined reference to 'std::__1::locale::locale()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:668: error: undefined reference to 'std::__1::ios_base::init(void*)'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/streambuf:370: error: undefined reference to 'std::__1::locale::locale()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4448: error: undefined reference to 'std::__1::__shared_weak_count::__release_shared()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:3639: error: undefined reference to 'std::__1::__shared_weak_count::~__shared_weak_count()'
/Users/krow/test/proj.android-studio/app/jni/./sdkbox/libs/armeabi-v7a/libsdkbox.a(Base64.o):Base64.cpp:typeinfo for std::__1::__shared_ptr_pointer<char*, std::__1::default_delete<char>, std::__1::allocator<char> >: error: undefined reference to 'typeinfo for std::__1::__shared_weak_count'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4448: error: undefined reference to 'std::__1::__shared_weak_count::__release_shared()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:3639: error: undefined reference to 'std::__1::__shared_weak_count::~__shared_weak_count()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4154: error: undefined reference to 'std::__1::__shared_weak_count::__add_shared()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4154: error: undefined reference to 'std::__1::__shared_weak_count::__add_shared()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4154: error: undefined reference to 'std::__1::__shared_weak_count::__add_shared()'
/Users/krow/test/proj.android-studio/app/jni/./sdkbox/libs/armeabi-v7a/libsdkbox.a(RequestManager.o):RequestManager.cpp:typeinfo for std::__1::__shared_ptr_pointer<sdkbox::XMLHttpRequest*, std::__1::default_delete<sdkbox::XMLHttpRequest>, std::__1::allocator<sdkbox::XMLHttpRequest> >: error: undefined reference to 'typeinfo for std::__1::__shared_weak_count'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:3639: error: undefined reference to 'std::__1::__shared_weak_count::~__shared_weak_count()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4154: error: undefined reference to 'std::__1::__shared_weak_count::__add_shared()'
/Users/krow/test/proj.android-studio/app/jni/./sdkbox/libs/armeabi-v7a/libsdkbox.a(SdkboxCore.o):SdkboxCore.cpp:typeinfo for std::__1::__shared_ptr_pointer<sdkbox::AppLifeCycleListener*, std::__1::default_delete<sdkbox::AppLifeCycleListener>, std::__1::allocator<sdkbox::AppLifeCycleListener> >: error: undefined reference to 'typeinfo for std::__1::__shared_weak_count'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/istream:288: error: undefined reference to 'std::__1::ctype<char>::id'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:668: error: undefined reference to 'std::__1::ios_base::init(void*)'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/streambuf:370: error: undefined reference to 'std::__1::locale::locale()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:3639: error: undefined reference to 'std::__1::__shared_weak_count::~__shared_weak_count()'
/Users/krow/test/proj.android-studio/app/jni/./sdkbox/libs/armeabi-v7a/libsdkbox.a(XMLHttpRequest.o):XMLHttpRequest.cpp:typeinfo for std::__1::__shared_ptr_pointer<sdkbox::XMLHttpRequestListener*, std::__1::default_delete<sdkbox::XMLHttpRequestListener>, std::__1::allocator<sdkbox::XMLHttpRequestListener> >: error: undefined reference to 'typeinfo for std::__1::__shared_weak_count'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/streambuf:370: error: undefined reference to 'std::__1::locale::locale()'
jni/src/LogAndroid.cpp:58: error: undefined reference to 'std::__1::cout'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:661: error: undefined reference to 'std::__1::ios_base::~ios_base()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:546: error: undefined reference to 'std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::id'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:546: error: undefined reference to 'std::__1::ctype<char>::id'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:668: error: undefined reference to 'std::__1::ios_base::init(void*)'
/Users/krow/test/proj.android-studio/app/jni/./pluginiap/libs_c++_static/armeabi-v7a/libPluginIAP.a(IAPWrapper.o):IAPWrapper.cpp:typeinfo for std::__1::basic_ios<char, std::__1::char_traits<char> >: error: undefined reference to 'typeinfo for std::__1::ios_base'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Unfortunately there are other parts of my project that need a newer NDK release to compile, so downgrading to 10d isn’t an option for me.
I guess the problem is statically linking libraries that were linked to different NDK versions.
Maybe it would help if SDKBox was linked dynamically on Android. Would it be possible to get a libsdkbox.so as an alternative to the current libsdkbox.a?
It sounds like this can work, according to this Stackoverflow post: