Admob crash on start (Android)

Admob crash on start (Android)
0

I tried to implement AdMob to my game,
I was not able to add it to my game at first try,
so I decided to make a fresh cocos project then add plugins that I need,
and then use it as a template.

So, I made a fresh cocos2d-x project using the command line,
then added the AdMob plugin using SDKBox GUI,
then opened it in Android Studio and tried to run it on my device.
But the game crashes on launch with this 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.cpp.AppActivity.onCreate(AppActivity.java:38)
 at android.app.Activity.performCreate(Activity.java:5982)
 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2375)
 at android.app.ActivityThread.access$900(ActivityThread.java:147)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loop(Looper.java:135)
 at android.app.ActivityThread.main(ActivityThread.java:5253)
 at java.lang.reflect.Method.invoke(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:372)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:913)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:708)

My environment info:
Win 10
Android Studio 3.4.2
JRE 1.8.0_152
Cmake 3.6
NDK r16
Cocos2d-x 3.17.2
SDKBox GUI 1.1.7

Thanks :pray:

plz check the CMakeLists.txt

are there some codes like:

+# PluginAdMob
+if(ANDROID)
+    add_definitions(-DSDKBOX_ENABLED)
+    add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/jni/PluginAdMob/)
+    target_link_libraries(${APP_NAME} ext_PluginAdMob)
+endif()

check jars?

~/test/cpp3171 [master] $ ls proj.android/app/libs/
PluginAdMob.jar     PluginFirebase.jar  PluginIAP.jar       PluginSdkboxAds.jar sdkbox.jar
1 Like

Thanks for the response,
The jar files were fine,
I didn’t have those lines in my CMake file, so I add them, but it gives me a bunch of build errors.
(Maybe I didn’t do that right! I don’t know much about how CMake config works!)

Anyway, I did the job with direct implementation of firebase, and it looks fine so far.
Again thanks for your response :+1:

A SDKBox CMake doc http://docs.sdkbox.com/en/qa/sdkbox-cmake/

1 Like