Cocos creator sdkbox integration error

Cocos creator sdkbox integration error
0.0 0

#1

I integrated SDKBox admob to cocos creator project.
It was compiled successfully, but when I run it on the android device, following error occur and show black screen.

Connected to process 9478 on device samsung-shv_e330l-4002b4b7
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
D/ResourcesManager: creating new AssetManager and set to /data/app/org.cocos2d.helloworld-1/base.apk
D/Cocos2dxActivity: Cocos2dxActivity onCreate: org.cocos2dx.javascript.AppActivity@3cf48f6d, savedInstanceState: null
I/CocosAnalytics: ==> enableLogging: false
D/JniHelper: JniHelper::setJavaVM(0xb4f5c640), pthread_self() = -1225412920
D/main: cocos_android_app_init
I/SDKBOX_CORE: Sdkbox Droid starting.
I/SDKBOX_CORE: Sdkbox got VM.
I/SDKBOX_CORE: Sdkbox jni initialized.
D/SDKBOX_CORE: Can't load tracking info: java.io.IOException: BufferedInputStream is closed
D/Cocos2dxHelper: isSupportLowLatency:false
D/Cocos2dxHelper: sampleRate: 48000, framesPerBuffer: 960
D/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp: nativeSetAudioDeviceInfo: sampleRate: 48000, bufferSizeInFrames: 960
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isShipBuild true
I/System.out: (HTTPLog)-Thread-27803-262101242: SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
W/System.err: java.lang.ClassNotFoundException: com.anysdk.framework.PluginWrapper
W/System.err:     at java.lang.Class.classForName(Native Method)
W/System.err:     at java.lang.Class.forName(Class.java:308)
W/System.err:     at java.lang.Class.forName(Class.java:272)
W/System.err:     at org.cocos2dx.javascript.SDKWrapper.getInstance(SDKWrapper.java:20)
W/System.err:     at org.cocos2dx.javascript.AppActivity.onCreateView(AppActivity.java:60)
W/System.err:     at org.cocos2dx.lib.Cocos2dxActivity.init(Cocos2dxActivity.java:438)
W/System.err:     at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:291)
W/System.err:     at org.cocos2dx.javascript.AppActivity.onCreate(AppActivity.java:40)
W/System.err:     at android.app.Activity.performCreate(Activity.java:6289)
W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
W/System.err:     at android.app.ActivityThread.access$900(ActivityThread.java:177)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err:     at android.os.Looper.loop(Looper.java:145)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5951)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.anysdk.framework.PluginWrapper" on path: DexPathList[[zip file "/data/app/org.cocos2d.helloworld-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cocos2d.helloworld-1/lib/arm, /vendor/lib, /system/lib]]
W/System.err:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
W/System.err: 	... 21 more
W/System.err: 	Suppressed: java.lang.ClassNotFoundException: com.anysdk.framework.PluginWrapper
W/System.err:     at java.lang.Class.classForName(Native Method)
W/System.err:     at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
W/System.err:     at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
W/System.err: 		... 22 more
W/System.err: 	Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.reflect.Method java.lang.Class.getMethod(java.lang.String, java.lang.Class[])' on a null object reference
W/System.err:     at org.cocos2dx.javascript.SDKWrapper.setGLSurfaceView(SDKWrapper.java:44)
W/System.err:     at org.cocos2dx.javascript.AppActivity.onCreateView(AppActivity.java:60)
W/System.err:     at org.cocos2dx.lib.Cocos2dxActivity.init(Cocos2dxActivity.java:438)
W/System.err:     at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:291)
W/System.err:     at org.cocos2dx.javascript.AppActivity.onCreate(AppActivity.java:40)
W/System.err:     at android.app.Activity.performCreate(Activity.java:6289)
W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
W/System.err:     at android.app.ActivityThread.access$900(ActivityThread.java:177)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err:     at android.os.Looper.loop(Looper.java:145)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5951)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
D/Cocos2dxActivity: model=SHV-E330L
D/Cocos2dxActivity: product=ks01ltelgt
D/Cocos2dxActivity: isEmulator=false
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.reflect.Method java.lang.Class.getMethod(java.lang.String, java.lang.Class[])' on a null object reference
W/System.err:     at org.cocos2dx.javascript.SDKWrapper.init(SDKWrapper.java:32)
W/System.err:     at org.cocos2dx.javascript.AppActivity.onCreate(AppActivity.java:51)
W/System.err:     at android.app.Activity.performCreate(Activity.java:6289)
W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
W/System.err:     at android.app.ActivityThread.access$900(ActivityThread.java:177)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err:     at android.os.Looper.loop(Looper.java:145)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5951)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
D/Activity: performCreate Call secproduct feature valuefalse
D/Activity: performCreate Call debug elastic valuetrue
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.reflect.Method java.lang.Class.getMethod(java.lang.String, java.lang.Class[])' on a null object reference
W/System.err:     at org.cocos2dx.javascript.SDKWrapper.onStart(SDKWrapper.java:164)
W/System.err:     at org.cocos2dx.javascript.AppActivity.onStart(AppActivity.java:133)
W/System.err:     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1234)
W/System.err:     at android.app.Activity.performStart(Activity.java:6329)
W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
W/System.err:     at android.app.ActivityThread.access$900(ActivityThread.java:177)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err:     at android.os.Looper.loop(Looper.java:145)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5951)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
D/Cocos2dxActivity: onResume()
D/AudioFocusManager: requestAudioFocus succeed
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.reflect.Method java.lang.Class.getMethod(java.lang.String, java.lang.Class[])' on a null object reference
W/System.err:     at org.cocos2dx.javascript.SDKWrapper.onResume(SDKWrapper.java:54)
W/System.err:     at org.cocos2dx.javascript.AppActivity.onResume(AppActivity.java:68)
W/System.err:     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1255)
W/System.err:     at android.app.Activity.performResume(Activity.java:6412)
W/System.err:     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3392)
W/System.err:     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3434)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2772)
W/System.err:     at android.app.ActivityThread.access$900(ActivityThread.java:177)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err:     at android.os.Looper.loop(Looper.java:145)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5951)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
D/ResourcesManager: creating new AssetManager and set to /data/app/com.google.android.gms-2/base.apk
W/ResourcesManager: Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
W/ResourcesManager: Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
D/OpenGLRenderer: Render dirty regions requested: true
I/Adreno-EGL: <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build:  ()
              OpenGL ES Shader Compiler Version: E031.25.01.03
              Build Date: 01/08/15 Thu
              Local Branch: LA.BF.1.1_RB1_20150108_025_1077123
              Remote Branch: 
              Local Patches: 
              Reconstruct Branch: 
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Get maximum texture size. GL_MAX_TEXTURE_SIZE is 4096
D/OpenGLRenderer: Enabling debug mode 0
I/System.out: KnoxVpnUidStorageknoxVpnSupported API value returned is false
D/cocos2d-x: {
             	gl.supports_OES_packed_depth_stencil: true
             	gl.supports_vertex_array_object: true
             	gl.supports_BGRA8888: false
             	cocos2d.x.version: 1.7.0
             	gl.supports_discard_framebuffer: true
             	cocos2d.x.compiled_with_profiler: false
             	gl.supports_PVRTC: false
             	cocos2d.x.build_type: DEBUG
             	gl.renderer: Adreno (TM) 330
             	gl.supports_OES_depth24: true
             	gl.supports_ETC1: true
             	gl.supports_OES_map_buffer: false
             	cocos2d.x.compiled_with_gl_state_cache: true
             	gl.version: OpenGL ES 3.0 V@84.0 AU@  (CL@)
             	gl.supports_NPOT: true
             	gl.max_texture_units: 32
             	gl.vendor: Qualcomm
             	gl.max_texture_size: 4096
             }
E/cocos2d-x: cocos2d: warning, Director::setProjection() failed because size is 0
D/jswrapper: Initializing V8, version: 6.0.286.52
D/Cocos2dxActivity: onWindowFocusChanged() hasFocus=true
I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@180bcad9 time:466868000
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: KnoxVpnUidStorageknoxVpnSupported API value returned is false
D/jswrapper: libuv version: 1.13.1
D/jswrapper: Debugger listening..., visit [ chrome-devtools://devtools/bundled/inspector.html?v8only=true&ws=0.0.0.0:5086/00010002-0003-4004-8005-000600070008 ] in chrome browser to debug!
D/jswrapper: For help see https://nodejs.org/en/docs/inspector
D/cocos2d-x: cocos2d: fullPathForFilename: No file found at script/jsb_prepare.jsc. Possible missing file.
D/cocos2d-x: cocos2d: fullPathForFilename: No file found at script/jsb_boot.jsc. Possible missing file.
D/jswrapper: JS: Cocos2d-x-lite v1.7.0
D/jswrapper: JS: Create unpacker 0127a760f for 91eLzcLhBEXbyUBOeH+ncZ
D/cocos2d-x: create rendererRecreatedListener for GLProgramState
D/cocos2d-x: cocos2d: QuadCommand: resizing index size from [-1] to [2560]
I/CocosAnalytics: ==> onResume()
E/CocosAnalytics: ==> Please init sdk first!
D/jswrapper: JS: Create unpacker 011c2e112 for deFQ8aMaFE6qXKmOwKv6zp
D/jswrapper: JS: LoadScene 91eLzcLhBEXbyUBOeH+ncZ: 546.4669999999999ms
D/jswrapper: JS: InitScene: 5.498000000000047ms
D/jswrapper: JS: AutoRelease: 0.5279999999997926ms
D/jswrapper: JS: Destroy: 0.2559999999998581ms
D/jswrapper: JS: Success to load scene: db://assets/scenes/loading.fire
D/jswrapper: JS: AttachPersist: 0.02500000000009095ms
D/cocos2d-x: create rendererRecreatedListener for GLProgramState
E/jswrapper: ERROR: Uncaught ReferenceError: sdkbox is not defined, location: src/project.dev.js:0:0
             STACK:
             [0]onLoad@src/project.dev.js:43788
             [1]anonymous@(no filename):3
             [2]invoke@src/jsb_polyfill.js:7943
             [3]activateNode@src/jsb_polyfill.js:16965
             [4]_activate@src/jsb_polyfill.js:6597
             [5]runSceneImmediate@src/jsb_polyfill.js:31141
             [6]anonymous@src/jsb_polyfill.js:31235
             [7]anonymous@src/jsb_polyfill.js:19262
             [8]anonymous@src/jsb_polyfill.js:15251
             [9]anonymous@src/jsb_polyfill.js:22659
             [10]onceWrapper@src/jsb_polyfill.js:14398
             [11]84.EventListeners.invoke@src/jsb_polyfill.js:14243
             [12]85.proto.emit@src/jsb_polyfill.js:14422
             [13]callback@src/jsb_polyfill.js:31275
E/jswrapper: [ERROR] (D:/CocosGame/Sources/GeniesGame/build/jsb-default/frameworks/cocos2d-x/cocos/scripting/js-bindings/proj.android/../jswrapper/v8/Object.cpp, 519): Invoking function (0x9c7783a0) failed!
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
E/CocosAnalytics: ==> Please init sdk first!
E/CocosAnalytics: ==> checkAndUploadLog, database is not open!
E/CocosAnalytics: ==> Please init sdk first!
E/CocosAnalytics: ==> checkAndUploadLog, database is not open!
E/CocosAnalytics: ==> Please init sdk first!
E/CocosAnalytics: ==> checkAndUploadLog, database is not open!
E/CocosAnalytics: ==> Please init sdk first!
E/CocosAnalytics: ==> checkAndUploadLog, database is not open!
E/CocosAnalytics: ==> Please init sdk first!
E/CocosAnalytics: ==> checkAndUploadLog, database is not open!

Please help me.
cocos creator version is 1.8.1


#2

I fixed this issue.
I added following lines to the AppDelegate.cpp file.

#ifdef SDKBOX_ENABLED
#include "PluginAdMobJS.hpp"
#include "PluginAdMobJSHelper.h"
#endif
#ifdef SDKBOX_ENABLED
se->addRegisterCallback(register_all_PluginAdMobJS);
se->addRegisterCallback(register_all_PluginAdMobJS_helper);
#endif

this is the solution at Problem with latest SDK box


AdMob error in Cocos Creator 1.9.1
AdMob for android crashes the app
Error sdkbox.PluginAdMob.init