Integrate Mopub in cocos2d-x v.3.x

1

I am facing a problem integrating Mopub Banner & Intersitial inside an Android App. I tried to add it in multiple manners but no one is working.

Someone has managed to integrate it? I manage to cache the ads, but when they get shown , nothing appears...the app seems to get blocked and get black screen, after few seconds it get automatically closed whitou writing any clear error log ..

Have you faced something similar? I Want to avoid SDKBOX since it does not support Mopub. Thanks

This is a capture of the Log:

8:30:17.406 2115-2115/? D/STATUSBAR-NetworkController: refreshSignalCluster: 

data=-1 bt=false
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge W/dalvikvm: threadid=1: spin on suspend #3 threadid=16 (pcf=0)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm: "main" prio=5 tid=1 RUNNABLE
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | group="main" sCount=0 dsCount=0 obj=0x40fe1508 self=0x40fd1660
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | sysTid=13827 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=1075257136
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | schedstat=( 485168449 392425546 912 ) utm=33 stm=15 core=0
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:~82)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.lang.StringBuffer.<init>(StringBuffer.java:69)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.util.regex.Matcher.replaceAll(Matcher.java:320)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.lang.String.replaceAll(String.java:1784)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mraid.MraidBridge.<init>(MraidBridge.java:77)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mraid.MraidBridge.<init>(MraidBridge.java:93)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mraid.MraidController.<init>(MraidController.java:122)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mobileads.MraidActivity.getAdView(MraidActivity.java:109)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mobileads.BaseInterstitialActivity.onCreate(BaseInterstitialActivity.java:58)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mobileads.MraidActivity.onCreate(MraidActivity.java:168)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.Activity.performCreate(Activity.java:5047)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.ActivityThread.access$700(ActivityThread.java:134)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.os.Looper.loop(Looper.java:137)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.ActivityThread.main(ActivityThread.java:4867)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.lang.reflect.Method.invokeNative(Native Method)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.lang.reflect.Method.invoke(Method.java:511)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at dalvik.system.NativeStart.main(Native Method)
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm: "GLThread 805" prio=5 tid=16 RUNNABLE
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | group="main" sCount=1 dsCount=0 obj=0x41a7ed20 self=0x5a35b590
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | sysTid=13876 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=1513470432
06-07 18:30:17.746 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | schedstat=( 1092346170 769592302 3068 ) utm=93 stm=16 core=1
06-07 18:30:17.756 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at org.cocos2dx.lib.Cocos2dxRenderer.nativeOnPause(Native Method)
06-07 18:30:17.756 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at org.cocos2dx.lib.Cocos2dxRenderer.handleOnPause(Cocos2dxRenderer.java:158)
06-07 18:30:17.756 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at org.cocos2dx.lib.Cocos2dxGLSurfaceView$4.run(Cocos2dxGLSurfaceView.java:197)
06-07 18:30:17.756 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
06-07 18:30:17.756 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
06-07 18:30:18.036 1691-1998/? I/sec_anm_ahi_output: standby() called
06-07 18:30:18.036 1691-1998/? I/sec_anm_ahi_output: Trying to drain devices
06-07 18:30:18.036 1694-1961/? I/ADM: 9: 31950741777: [INFO] api_devset:824 devapi_drain, draining 41398008.0
06-07 18:30:18.056 1694-1961/? I/ADM: 8: 31950767076: [INFO] omx_io:651 il_tool_io_empty_buffer_done: Idle callback requested, issuing..
06-07 18:30:18.056 1694-1961/? I/ADM: 0: 31950767137: [INFO] api_devset:835 Drain complete, sending reply msg
06-07 18:30:18.056 1691-1998/? I/sec_anm_ahi_output: Drain devices done
06-07 18:30:18.056 1691-1998/? I/sec_anm_ahi_output: adm_api: ste_adm_close_device(Speaker)
06-07 18:30:18.056 1694-1961/? I/ADM: 3: 31950767381: [STATUS] api_devset:316 Close device 'Speaker'
06-07 18:30:18.056 1694-1961/? I/ADM: 6: 31950767533: [OMXIL] omx_log:957 41398008 [ADM.splitter]: SendCommand PortDisable 0
06-07 18:30:18.056 1694-1961/? I/ADM: 7: 31950767564: [INFO] omx_io:410 il_tool_io_wait_until_idle: 42DD5008.0 idle, returning
06-07 18:30:18.056 1694-1961/? I/ADM: 8: 31950767625: [OMXIL] omx_log:1113 41398008 [ADM.splitter]: FreeBuf port=0 pBuf=456F6F88
06-07 18:30:18.056 1694-1961/? I/ADM: 9: 31950767656: [OMXIL] omx_log:1113 41398008 [ADM.splitter]: FreeBuf port=0 pBuf=4003BF38
06-07 18:30:18.056 1694-1961/? I/ADM: 9: 31950767686: [OMXIL] omx_log:1113 41398008 [ADM.splitter]: FreeBuf port=0 pBuf=41377F18
06-07 18:30:18.056 1694-1961/? I/ADM: 0: 31950767747: [OMXIL] omx_log:256 41398008 [ADM.splitter]: CB CmdComplete PortDisable 0
06-07 18:30:18.056 1694-1961/? I/ADM: 2: 31950767869: [OMXIL] omx_log:957 41398008 [ADM.splitter]: SendCommand PortDisable 1
06-07 18:30:18.056 1694-1961/? I/ADM: 3: 31950767930: [OMXIL] omx_log:256 41398008 [ADM.splitter]: CB CmdComplete PortDisable 1
06-07 18:30:18.056 1694-1961/? I/ADM: 4: 31950767961: [OMXIL] omx_log:957 45DDB008 [ADM.mixer   ]: SendCommand PortDisable 1
06-07 18:30:18.056 1694-1961/? I/ADM: 4: 31950768022: [OMXIL] omx_log:256 45DDB008 [ADM.mixer   ]: CB CmdComplete PortDisable 1
06-07 18:30:18.056 1694-1961/? I/ADM: 6: 31950768113: [INFO] dev:519  >>> ENTER dev_close(101)
06-07 18:30:18.056 1694-1961/? I/ADM: 8: 31950768235: [INFO] dev:306 setting /data/local/tmp/rme_act_adm to 1
06-07 18:30:18.056 1694-1961/? I/ADM: 1: 31950768418: [INFO] dev:347 rme alp tracker /data/local/tmp/rme_act_alp set to 0: proceeding
06-07 18:30:18.056 1694-1961/? I/ADM: 4: 31950769212: [INFO] dev_omx:1517 Enter dev_omx_close_graph - logical_handle=1  dealloc_buffers=0
06-07 18:30:18.056 1694-1961/? I/ADM: 5: 31950769273: [INFO] dev_omx:1534 Closing last device. Request audiocodec to ramp down audio
06-07 18:30:18.056 1694-1961/? I/ADM: 6: 31950769303: [OMXIL] omx_log:913 41378CC0 [X.ST.AFM.IHF]: SetConfig idx=Mute
06-07 18:30:18.056 1694-1961/? I/ADM: 7: 31950769334: [OMXIL] omx_log:293     port=0 mute=1
06-07 18:30:18.096 1694-1968/? I/ADM: 8: 31950802415: [OMXIL] omx_log:256 41378CC0 [X.ST.AFM.IHF]: CB EventIndexSettingChanged port=67108901 index=OMX_ALL
06-07 18:30:18.096 1694-1968/? I/ADM: 9: 31950802476: [OMXIL] omx_log:256 41378CC0 [X.ST.AFM.IHF]: CB EventIndexSettingChanged port=-1 index=Mute
06-07 18:30:18.096 1694-1961/? I/ADM: 8: 31950803025: [INFO] dev_omx_graph:1181 Enter graph_disconnect_app_effects_from_common_mix_split
06-07 18:30:18.096 1694-1961/? I/ADM: 0: 31950803697: [OMXIL] omx_log:957 41378570 [ocessing.spl]: SendCommand PortDisable 1
06-07 18:30:18.096 1694-1961/? I/ADM: 8: 31950804185: [OMXIL] omx_log:957 413782E0 [ST.AFM.mixer]: SendCommand PortDisable 1
06-07 18:30:18.096 1694-1968/? I/ADM: 9: 31950805436: [OMXIL] omx_log:256 413782E0 [ST.AFM.mixer]: CB CmdComplete PortDisable 1
06-07 18:30:18.096 1694-1968/? I/ADM: 7: 31950807054: [OMXIL] omx_log:256 41378570 [ocessing.spl]: CB CmdComplete PortDisable 1
06-07 18:30:18.096 1694-1961/? I/ADM: 9: 31950807237: [OMXIL] omx_log:954 45DDB008 [ADM.mixer   ]: SendCommand StateSet StateIdle
06-07 18:30:18.096 1694-1961/? I/ADM: 1: 31950807298: [OMXIL] omx_log:954 41378570 [ocessing.spl]: SendCommand StateSet StateIdle
06-07 18:30:18.096 1694-1981/? I/ADM: 6: 31950807634: [OMXIL] omx_log:256 45DDB008 [ADM.mixer   ]: CB CmdComplete StateSet StateIdle
06-07 18:30:18.096 1694-1968/? I/ADM: 1: 31950807908: [OMXIL] omx_log:256 41378570 [ocessing.spl]: CB CmdComplete StateSet StateIdle
06-07 18:30:18.096 1694-1961/? I/ADM: 5: 31950808152: [OMXIL] omx_log:954 413782E0 [ST.AFM.mixer]: SendCommand StateSet StateIdle
06-07 18:30:18.096 1694-1968/? I/ADM: 4: 31950808702: [OMXIL] omx_log:256 413782E0 [ST.AFM.mixer]: CB CmdComplete StateSet StateIdle
06-07 18:30:18.096 1694-1961/? I/ADM: 5: 31950808702: [OMXIL] omx_log:954 413788E8 [ocessing.spl]: SendCommand StateSet StateIdle
06-07 18:30:18.096 1694-1961/? I/ADM: 1: 31950809129: [OMXIL] omx_log:954 41378CC0 [X.ST.AFM.IHF]: SendCommand StateSet StateIdle
06-07 18:30:18.106 1694-1968/? I/ADM: 2: 31950810289: [OMXIL] omx_log:256 413788E8 [ocessing.spl]: CB CmdComplete StateSet StateIdle
06-07 18:30:18.106 1694-1968/? I/ADM: 2: 31950811540: [OMXIL] omx_log:256 41378CC0 [X.ST.AFM.IHF]: CB CmdComplete StateSet StateIdle
06-07 18:30:18.106 1694-1961/? I/ADM: 0: 31950811937: [OMXIL] omx_log:954 41378CC0 [X.ST.AFM.IHF]: SendCommand StateSet StateLoaded
06-07 18:30:18.117 1694-1968/? I/ADM: 0: 31950820848: [OMXIL] omx_log:256 41378CC0 [X.ST.AFM.IHF]: CB CmdComplete StateSet StateLoaded
06-07 18:30:18.117 1694-1961/? I/ADM: 3: 31950820970: [OMXIL] omx_log:954 413788E8 [ocessing.spl]: SendCommand StateSet StateLoaded
06-07 18:30:18.117 1694-1968/? I/ADM: 9: 31950826677: [OMXIL] omx_log:256 413788E8 [ocessing.spl]: CB CmdComplete StateSet StateLoaded
06-07 18:30:18.117 1694-1961/? I/ADM: 1: 31950826799: [OMXIL] omx_log:954 413782E0 [ST.AFM.mixer]: SendCommand StateSet StateLoaded
06-07 18:30:18.127 1694-1968/? I/ADM: 1: 31950831468: [OMXIL] omx_log:256 413782E0 [ST.AFM.mixer]: CB CmdComplete StateSet StateLoaded
06-07 18:30:18.127 1694-1961/? I/ADM: 3: 31950831620: [OMXIL] omx_log:954 41378570 [ocessing.spl]: SendCommand StateSet StateLoaded
06-07 18:30:18.127 1694-1961/? I/ADM: 7: 31950838914: [OMXIL] omx_log:954 45DDB008 [ADM.mixer   ]: SendCommand StateSet StateLoaded
06-07 18:30:18.127 1694-1961/? I/ADM: 8: 31950839006: [OMXIL] omx_log:256 45DDB008 [ADM.mixer   ]: CB CmdComplete StateSet StateLoaded
06-07 18:30:18.127 1694-1968/? I/ADM: 5: 31950839433: [OMXIL] omx_log:256 41378570 [ocessing.spl]: CB CmdComplete StateSet StateLoaded
06-07 18:30:18.127 1694-1961/? I/ADM: 2: 31950839830: [OMXIL] omx_log:256 41378570 [ocessing.spl]: FreeHandle
06-07 18:30:18.137 1694-1961/? I/ADM: 3: 31950840501: [OMXIL] omx_log:256 45DDB008 [ADM.mixer   ]: FreeHandle
06-07 18:30:18.137 1694-1961/? I/ADM: 7: 31950840684: [OMXIL] omx_log:256 413788E8 [ocessing.spl]: FreeHandle
06-07 18:30:18.137 1694-1961/? I/ADM: 5: 31950841142: [OMXIL] omx_log:256 41378CC0 [X.ST.AFM.IHF]: FreeHandle
06-07 18:30:18.137 1694-1961/? I/ADM: 3: 31950841600: [OMXIL] omx_log:256 413782E0 [ST.AFM.mixer]: FreeHandle
06-07 18:30:18.137 1694-1961/? I/ADM: 0: 31950842088: [INFO] dev_omx:1646 All OMX handles freed successfully
06-07 18:30:18.137 1694-1961/? I/ADM: 1: 31950842149: [INFO] dev_omx:1722 Graph closed successfully! ref_cnt = 0
06-07 18:30:18.137 1694-1961/? I/ADM: 4: 31950842302: [INFO] dev:1684 rescan_hw_handler
06-07 18:30:18.137 1694-1961/? I/ADM: 5: 31950842393: [INFO] hw_handler_u8500:461 AddD2DConnections ENTER
06-07 18:30:18.137 1694-1961/? I/ADM: 1: 31950843309: [INFO] dev:1675 hw_handler_dev_next_d2d: DONE
06-07 18:30:18.137 1694-1961/? I/ADM: 4: 31950843461: [INFO] dev:1654 hw_handler_dev_next: DONE
06-07 18:30:18.137 1694-1961/? I/ADM: 5: 31950844102: [INFO] hw_handler_u8500:849 Query: SELECT * FROM HW_Settings WHERE (Platform = 'AB8500') AND (Dev1 ='')ORDER BY rowid LIMIT 1
06-07 18:30:18.137 1694-1961/? I/ADM: 6: 31950845933: [INFO] hw_handler_u8500:961 ste_adm_hw_handler_u8500: Found matching HW-settings: devices = ('', '', '', '', '', ''), d2dlogical-connections = ('', '', '', '').
06-07 18:30:18.157 1694-1961/? I/ADM: 4: 31950861192: [INFO] dev:834 Updating event subscriptions for device Speaker
06-07 18:30:18.157 1694-1961/? I/ADM: 6: 31950861253: [INFO] dev:579  >>> LEAVE dev_close(101)
06-07 18:30:18.157 1694-1961/? I/ADM: 8: 31950861375: [INFO] dev:306 setting /data/local/tmp/rme_act_adm to 0
06-07 18:30:18.157 1694-1961/? I/ADM: 4: 31950862321: [INFO] api_devset:392 Releasing splitter; no longer used
06-07 18:30:18.157 1694-1961/? I/ADM: 5: 31950862413: [OMXIL] omx_log:954 41398008 [ADM.splitter]: SendCommand StateSet StateIdle
06-07 18:30:18.157 1694-1961/? I/ADM: 6: 31950862535: [OMXIL] omx_log:256 41398008 [ADM.splitter]: CB CmdComplete StateSet StateIdle
06-07 18:30:18.157 1694-1961/? I/ADM: 9: 31950862596: [OMXIL] omx_log:954 41398008 [ADM.splitter]: SendCommand StateSet StateLoaded
06-07 18:30:18.157 1694-1961/? I/ADM: 9: 31950862687: [OMXIL] omx_log:256 41398008 [ADM.splitter]: CB CmdComplete StateSet StateLoaded
06-07 18:30:18.157 1694-1961/? I/ADM: 1: 31950862748: [OMXIL] omx_log:256 41398008 [ADM.splitter]: FreeHandle
06-07 18:30:18.157 1694-1961/? I/ADM: 2: 31950862809: [INFO] api_devset:408 CloseDevice(Speaker) OK
06-07 18:30:18.417 2115-2115/? D/STATUSBAR-NetworkController: refreshSignalCluster: data=-1 bt=false
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge W/dalvikvm: threadid=1: spin on suspend #4 threadid=16 (pcf=0)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm: "main" prio=5 tid=1 RUNNABLE
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | group="main" sCount=0 dsCount=0 obj=0x40fe1508 self=0x40fd1660
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | sysTid=13827 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=1075257136
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | schedstat=( 487091056 410797128 945 ) utm=33 stm=15 core=0
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:~82)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.lang.StringBuffer.<init>(StringBuffer.java:69)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.util.regex.Matcher.replaceAll(Matcher.java:320)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.lang.String.replaceAll(String.java:1784)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mraid.MraidBridge.<init>(MraidBridge.java:77)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mraid.MraidBridge.<init>(MraidBridge.java:93)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mraid.MraidController.<init>(MraidController.java:122)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mobileads.MraidActivity.getAdView(MraidActivity.java:109)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mobileads.BaseInterstitialActivity.onCreate(BaseInterstitialActivity.java:58)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.mopub.mobileads.MraidActivity.onCreate(MraidActivity.java:168)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.Activity.performCreate(Activity.java:5047)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.ActivityThread.access$700(ActivityThread.java:134)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.os.Looper.loop(Looper.java:137)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.app.ActivityThread.main(ActivityThread.java:4867)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.lang.reflect.Method.invokeNative(Native Method)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at java.lang.reflect.Method.invoke(Method.java:511)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at dalvik.system.NativeStart.main(Native Method)
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm: "GLThread 805" prio=5 tid=16 RUNNABLE
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | group="main" sCount=1 dsCount=0 obj=0x41a7ed20 self=0x5a35b590
06-07 18:30:18.507 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | sysTid=13876 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=1513470432
06-07 18:30:18.517 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:   | schedstat=( 1092346170 769592302 3068 ) utm=93 stm=16 core=1
06-07 18:30:18.517 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at org.cocos2dx.lib.Cocos2dxRenderer.nativeOnPause(Native Method)
06-07 18:30:18.517 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at org.cocos2dx.lib.Cocos2dxRenderer.handleOnPause(Cocos2dxRenderer.java:158)
06-07 18:30:18.517 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at org.cocos2dx.lib.Cocos2dxGLSurfaceView$4.run(Cocos2dxGLSurfaceView.java:197)
06-07 18:30:18.517 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
06-07 18:30:18.517 13827-13827/com.kangaroo.logicchallenge I/dalvikvm:     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
06-07 18:30:18.887 14042-14042/? A/libc: Fatal signal 13 (SIGPIPE) at 0x000036da (code=0), thread 14042 (sh)
admob
cocos2d-x
cocos2d-x-3.0
mopub
cocos2d-x-3.x
asked on Stack Overflow Jun 7, 2017 by X.Otano

1 Answer

0
  1. Inject dependency in Android build.gradle file

    dependencies {
       compile fileTree(dir: 'libs', include: ['*.jar'])
       compile project(':libcocos2dx')
    
       compile 'com.google.android.gms:play-services-ads:10.0.1'
    
       compile('com.mopub:mopub-sdk:4.14.0@aar') {
          transitive = true
       }
    }
    

    Set minSdkVersion 16

    defaultConfig {
       applicationId "com.its.adservice"
       minSdkVersion 16
       targetSdkVersion PROP_TARGET_SDK_VERSION
       versionCode 1
       versionName "1.0"
       ...
    }
    
  2. Add required permission and Activity in AndroidManifest.xml file

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    
    <activity android:name="com.mopub.mobileads.MoPubActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.mopub.mobileads.MraidActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.mopub.common.MoPubBrowser" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.mopub.mobileads.RewardedMraidActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
    
    <meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version" />
    
  3. AppActivity

    private static final String AD_UNIT_ID="XXXXXXXXXX";
    private static final String INTERSTITIAL_AD_UNIT_ID= "XXXXXXXXX";
    private MoPubView moPubView;
    public static MoPubInterstitial mInterstitial;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
    
       moPubView = new MoPubView(this);
       moPubView.setAdUnitId(AD_UNIT_ID);
       moPubView.setBannerAdListener(new MoPubView.BannerAdListener(){
    
        @Override
        public void onBannerLoaded(MoPubView banner) {
    
        }
    
        @Override
        public void onBannerFailed(MoPubView banner, MoPubErrorCode errorCode) {
    
        }
    
        @Override
        public void onBannerClicked(MoPubView banner) {
    
        }
    
        @Override
        public void onBannerExpanded(MoPubView banner) {
    
        }
    
        @Override
        public void onBannerCollapsed(MoPubView banner) {
    
        }
      });
    
       moPubView.loadAd();
    
       RelativeLayout relativeLayout=new RelativeLayout(this);
    
       RelativeLayout.LayoutParams bottomParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
       bottomParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,RelativeLayout.TRUE);
       bottomParams.addRule(RelativeLayout.CENTER_HORIZONTAL,RelativeLayout.TRUE);
       relativeLayout.addView(moPubView, bottomParams);
    
       addContentView(relativeLayout, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
       relativeLayout.bringToFront();
    
    
       mInterstitial = new MoPubInterstitial(androidLauncher, INTERSTITIAL_AD_UNIT_ID);
       mInterstitial.setInterstitialAdListener(new MoPubInterstitial.InterstitialAdListener(){
    
        @Override
        public void onInterstitialLoaded(MoPubInterstitial interstitial) {
    
        }
    
        @Override
        public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) {
    
        }
    
        @Override
        public void onInterstitialShown(MoPubInterstitial interstitial) {
    
        }
    
        @Override
        public void onInterstitialClicked(MoPubInterstitial interstitial) {
    
        }
    
        @Override
        public void onInterstitialDismissed(MoPubInterstitial interstitial) {
                mInterstitial.load();
        }
      });
    
        mInterstitial.load();
    }
    
    @Override
    public void onDestroy() {
       moPubView.destroy();
       mInterstitial.destroy();
       super.onDestroy();
    }
    
    public static void showOrLoadInterstitial() {    
         if (mInterstitial.isReady()) {
             mInterstitial.show();
         } else {
             mInterstitial.load();
         }
     }
    

Whenever you want to show interstitial Ad call static method showOrLoadInterstitial through JNI.

answered on Stack Overflow Jun 8, 2017 by Abhishek Aryan

User contributions licensed under CC BY-SA 3.0