cocos2d-x can't work in android 4.2.2,but it can work in android2.2.3


#1

I use cocos2d-x2.2.1 version,it can work in android 2.2.3, but it cant’t work in android4.2.2,SDK 17.Here is the log.
03-09 22:54:34.898: W/dalvikvm(10517): Invalid indirect reference 0x4269aaf8 in decodeIndirectRef
03-09 22:54:34.898: I/dalvikvm(10517): “GLThread 390” prio=5 tid=11 RUNNABLE
03-09 22:54:34.898: I/dalvikvm(10517): | group=“main” sCount=0 dsCount=0 obj=0x42695de0 self=0x4008f410
03-09 22:54:34.898: I/dalvikvm(10517): | sysTid=10533 nice=0 sched=0/0 cgrp=apps handle=1074329704
03-09 22:54:34.898: I/dalvikvm(10517): | state=R schedstat=( 1292397000 188816000 2210 ) utm=109 stm=20 core=2
03-09 22:54:34.898: I/dalvikvm(10517): at org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(Native Method)
03-09 22:54:34.898: I/dalvikvm(10517): at org.cocos2dx.lib.Cocos2dxRenderer.onSurfaceCreated(Cocos2dxRenderer.java:72)
03-09 22:54:34.898: I/dalvikvm(10517): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1501)
03-09 22:54:34.898: I/dalvikvm(10517): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
03-09 22:54:34.898: E/dalvikvm(10517): VM aborting
03-09 22:54:34.898: A/libc(10517): Fatal signal 6 (SIGABRT) at 0x00002915 (code=-6), thread 10533 (Thread-390)


#2

How to reproduce it?


#3

@zhangxm In AndroidManifest.xml,it can work if set <uses-sdk android:minSdkVersion=“8”, but can’t work if set .
Tks.


#4

I have not idea.
Why you set targetSdkVersion?


#5

I’m encountering this on 4.3 with cocos2dx v3.1.1.

It happens for me when I call native C++ function from the Java side.

Logcat

07-28 04:57:52.662: W/ActivityThread(19195): Application com.mycompany.mygame can be debugged on port 8100...
07-28 04:57:52.692: D/dalvikvm(19195): Trying to load lib /data/app-lib/com.mycompany.mygame-1/libcocos2dcpp.so 0x422a9108
07-28 04:57:52.712: D/dalvikvm(19195): Added shared lib /data/app-lib/com.mycompany.mygame-1/libcocos2dcpp.so 0x422a9108
07-28 04:57:52.712: D/JniHelper(19195): JniHelper::setJavaVM(0x4178e108), pthread_self() = 1074114556
07-28 04:57:52.782: D/Cocos2dxActivity(19195): model=SGH-T999
07-28 04:57:52.782: D/Cocos2dxActivity(19195): product=d2tmo
07-28 04:57:52.782: D/Cocos2dxActivity(19195): isEmulator=false
07-28 04:57:52.892: I/webclipboard(19195): clipservice: android.sec.clipboard.ClipboardExManager@422ccee8
07-28 04:57:52.912: D/JSENGINE(19195): qualcomm.jsengine.version:C.2-patch36-git:a745801
07-28 04:57:52.922: D/MoPub(19195): Failed to retrieve GPS location: access appears to be disabled.
07-28 04:57:52.922: D/MoPub(19195): Failed to retrieve network location: access appears to be disabled.
07-28 04:57:53.002: V/webkit(19195): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {42466db0}
07-28 04:57:53.002: D/MoPub(19195): Loading url: http://ads.mopub.com/m/ad?v=6&id=4f15932d84b54071b1845b2629083dc6&nv=2.2&dn=samsung%2CSGH-T999%2Cd2tmo&udid=sha%3A5c148c790d430f9dc6f855d51950255f568c20ac&q=FBATTRID%3Afb505f29-1840-4998-9698-9a7e5a341aa1&z=-0400&o=p&sc_a=2.0&mr=1&mcc=310&mnc=260&iso=us&cn=T-Mobile&ct=2&av=1.4&android_perms_ext_storage=1&ts=1
07-28 04:57:53.002: I/MoPub(19195): Fetching ad for task #0
07-28 04:57:53.012: I/APACHE HTTP (thCr=1) - NafHttpAuthStrategyDefault(19195): (thUse=1) NafHttpAuthStrategyDefault()
07-28 04:57:53.012: I/APACHE HTTP (thCr=1) - KeeperManager(19195): (thUse=1) INITIALIZATION of shared resources
07-28 04:57:53.012: I/APACHE HTTP (thCr=1) - AndroidContextProviderImpl(19195): (thUse=1)    currentActivityThread=android.app.ActivityThread@422a3b88
07-28 04:57:53.022: I/APACHE HTTP (thCr=1) - NafHttpAuthStrategyDefault(19195): (thUse=19695)    cached value : gbaSupportIsPossible=null
07-28 04:57:53.022: I/APACHE HTTP (thCr=1) - NafHttpAuthStrategyDefault(19195): (thUse=19695)    The current context is NOT a context of GBA service.
07-28 04:57:53.022: I/APACHE HTTP (thCr=1) - GbaSupportPermissionRequestCheckerImpl(19195): (thUse=19695) isCurrentProcessRequestedGba()#finished   result=false
07-28 04:57:53.022: I/APACHE HTTP (thCr=1) - GbaSupportPermissionRequestCheckerImpl(19195): (thUse=19695) isCurrentProcessAllowedToUseGba()#started   result=false
07-28 04:57:53.022: I/APACHE HTTP (thCr=1) - NafHttpAuthStrategyDefault(19195): (thUse=19695)    The GBA permission wasn't requested for this process.
07-28 04:57:53.022: I/APACHE HTTP (thCr=1) - NafHttpAuthStrategyDefault(19195): (thUse=19695) It is impossible to support GBA now (many possible reasons: no Android Context, current client is GBA service, etc.), then it will be just usual HTTP.
07-28 04:57:53.022: I/APACHE HTTP (thCr=19695) - NafRequestExecutorWrapperRedirectionHandler(19195): (thUse=19695)    It isn't GBA flow, redirection responses are not handled.
07-28 04:57:53.062: I/Crashlytics(19195): Initializing Crashlytics 1.1.11.10
07-28 04:57:53.142: D/libEGL(19195): loaded /system/lib/egl/libEGL_adreno200.so
07-28 04:57:53.152: D/libEGL(19195): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
07-28 04:57:53.162: D/libEGL(19195): loaded /system/lib/egl/libGLESv2_adreno200.so
07-28 04:57:53.162: I/Adreno200-EGL(19195): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build: HAREESHG_Nondeterministic_AU+PATCH[ES]_msm8960_JB_1.9.6_MR2_CL3219408_release_ENGG (CL3219408)
07-28 04:57:53.162: I/Adreno200-EGL(19195): Build Date: 09/28/13 Sat
07-28 04:57:53.162: I/Adreno200-EGL(19195): Local Branch: hhh
07-28 04:57:53.162: I/Adreno200-EGL(19195): Remote Branch: quic/jb_1.9.6_1
07-28 04:57:53.162: I/Adreno200-EGL(19195): Local Patches: 8d50ec23e42ef52b570aa6ff1650afac0b503d78 CL3219408: Fix in the Glreadpixels for negative offsets and larger dimensions.
07-28 04:57:53.162: I/Adreno200-EGL(19195):                  801859126f6ca69482b39a34ca61447e3f7cded8 rb: fix panel settings to clear undrawn/undefined buffers
07-28 04:57:53.162: I/Adreno200-EGL(19195): Reconstruct Branch: LOCAL_PATCH[ES]
07-28 04:57:53.212: D/OpenGLRenderer(19195): Enabling debug mode 0
07-28 04:57:53.252: D/cocos2d-x debug info(19195): {
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.supports_vertex_array_object: true
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.supports_BGRA8888: false
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.supports_ATITC: true
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.supports_S3TC: false
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  cocos2d.x.version: cocos2d-x 3.1.1
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.supports_discard_framebuffer: false
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  cocos2d.x.compiled_with_profiler: false
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.supports_PVRTC: false
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  cocos2d.x.build_type: DEBUG
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.renderer: Adreno (TM) 225
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.supports_ETC1: true
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  cocos2d.x.compiled_with_gl_state_cache: true
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.version: OpenGL ES 2.0 V@31.0 AU@ HAREESHG_Nondeterministic_AU+PATCH[ES]_msm8960_JB_1.9.6_MR2_CL3219408_release_ENGG (CL@3219408)
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.supports_NPOT: true
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.max_texture_units: 20
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.vendor: Qualcomm
07-28 04:57:53.252: D/cocos2d-x debug info(19195):  gl.max_texture_size: 4096
07-28 04:57:53.252: D/cocos2d-x debug info(19195): }
07-28 04:57:53.492: D/cocos2d-x debug info(19195): create _backToForegroundlistener for GLProgramState
07-28 04:57:53.492: D/main(19195): cocos_android_app_init
07-28 04:57:53.502: D/MoPub(19195): Loading ad type: mraid
07-28 04:57:53.512: D/cocos2d-x debug info(19195): Trying to cache first ad.
07-28 04:57:53.512: D/cocos2d-x debug info(19195): Using Java JNI signature ()V...
07-28 04:57:53.512: D/cocos2d-x debug info(19195): About to call Java method from C++: 'cacheAd'...
07-28 04:57:53.512: W/dalvikvm(19195): Bogus method descriptor: cacheAd
07-28 04:57:53.512: D/JniHelper(19195): Failed to find static method id of cacheAd
07-28 04:57:53.512: D/cocos2d-x debug info(19195): Finished calling Java method from C++: 'cacheAd'.
07-28 04:57:53.512: D/cocos2d-x debug info(19195): create _backToForegroundlistener for GLProgramState
07-28 04:57:53.512: D/CCFileUtilsAndroid.cpp(19195): relative path = wtk-assets/sprites/spritesheet.plist
07-28 04:57:53.543: D/CCFileUtilsAndroid.cpp(19195): relative path = wtk-assets/sprites/spritesheet.png
07-28 04:57:53.963: D/MoPub(19195): Loading custom event interstitial adapter.
07-28 04:57:53.963: D/MoPub(19195): Attempting to invoke custom event: com.mopub.mobileads.MraidInterstitial
07-28 04:57:53.993: I/webclipboard(19195): clipservice: android.sec.clipboard.ClipboardExManager@425b9440
07-28 04:57:53.993: V/webkit(19195): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {425b92b8}
07-28 04:57:54.634: E/SQLiteLog(19195): (14) cannot open file at line 32479 of [00bb9c9ce4]
07-28 04:57:54.634: E/SQLiteLog(19195): (14) os_unix.c:32479: (2) open(/CachedGeoposition.db) - 
07-28 04:57:54.634: D/WebKit(19195): ERROR: 
07-28 04:57:54.634: D/WebKit(19195): SQLite database failed to load from /CachedGeoposition.db
07-28 04:57:54.634: D/WebKit(19195): Cause - unable to open database file
07-28 04:57:54.634: D/WebKit(19195): external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp(71) : bool WebCore::SQLiteDatabase::open(const WTF::String&, bool)
07-28 04:57:55.104: W/dalvikvm(19195): Invalid indirect reference 0x422b0688 in decodeIndirectRef
07-28 04:57:55.104: I/dalvikvm(19195): "GLThread 19688" prio=5 tid=13 RUNNABLE
07-28 04:57:55.104: I/dalvikvm(19195):   | group="main" sCount=0 dsCount=0 obj=0x422ed810 self=0x5da60808
07-28 04:57:55.104: I/dalvikvm(19195):   | sysTid=19210 nice=0 sched=0/0 cgrp=apps handle=1571163224
07-28 04:57:55.104: I/dalvikvm(19195):   | state=R schedstat=( 0 0 0 ) utm=108 stm=9 core=0
07-28 04:57:55.104: I/dalvikvm(19195):   at org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(Native Method)
07-28 04:57:55.104: I/dalvikvm(19195):   at org.cocos2dx.lib.Cocos2dxRenderer.onSurfaceCreated(Cocos2dxRenderer.java:73)
07-28 04:57:55.104: I/dalvikvm(19195):   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1509)
07-28 04:57:55.104: I/dalvikvm(19195):   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
07-28 04:57:55.104: E/dalvikvm(19195): VM aborting
07-28 04:57:55.104: A/libc(19195): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 19210 (Thread-19688)

Ndk stack trace (armeabi + armeabi-v7a)

********** Crash dump: **********
Build fingerprint: 'samsung/d2tmo/d2tmo:4.3/JSS15J/T999UVUENC2:user/release-keys'
pid: 19195, tid: 19210, name: Thread-19688  >>> com.mycompany.myapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d
Stack frame #00  pc 00049028  /system/lib/libdvm.so (dvmAbort+67)
Stack frame #01  pc 0004dad3  /system/lib/libdvm.so (dvmDecodeIndirectRef(Thread*, _jobject*)+146)
Stack frame #02  pc 0004eb5f  /system/lib/libdvm.so
Stack frame #03  pc 00adaf74  /data/app-lib/com.mycompany.myapp-1/libcocos2dcpp.so (_JNIEnv::GetStaticMethodID(_jclass*, char const*, char const*)+56)
Stack frame #04  pc 00adb578  /data/app-lib/com.mycompany.myapp-1/libcocos2dcpp.so (cocos2d::JniHelper::getStaticMethodInfo(cocos2d::JniMethodInfo_&, char const*, char const*, char const*)+216)
Stack frame #05  pc 00ad9df4  /data/app-lib/com.mycompany.myapp-1/libcocos2dcpp.so (getPackageNameJNI()+108)
Stack frame #06  pc 008aa094  /data/app-lib/com.mycompany.myapp-1/libcocos2dcpp.so (cocos2d::UserDefault::initXMLFilePath()+56)
Stack frame #07  pc 008a9f88  /data/app-lib/com.mycompany.myapp-1/libcocos2dcpp.so (cocos2d::UserDefault::getInstance()+16)
Stack frame #08  pc 005df100  /data/app-lib/com.mycompany.myapp-1/libcocos2dcpp.so (RRS::Db::getBool(int, bool)+88)

In my AndroidManifest.xml I have minSdkVersion set to 10 and targetSdkVersion set to 17.

In my Application.mk I have APP_PLATFORM set to android-10.

I’m using Cocos2dxActivity

Still investigating more to see if I can narrow it down more specifically…


#6

Solved my issue: I had a subtle bug when building Java jni signature and package name programmatically.


#7

I know that a lot of time has passed since this issue, but I am facing the same right now.
How did you fix it? Could you please explain? That would be very useful!


#8

Edit: I finally found the source of my game’s bug. It seems that we were instantiating a cocos2d::UserDefault (because it was a static member variable of a class), and because of being static, its initialization time is undefined (I think it’s compiler-dependant because it didn’t crash on iOS but it did on Android). After some CCLOGs, we found it instantiating even before the AppDelegate’s constructor. Maybe some cocos-related stuff wasn’t in memory yet and that premature instantiation of a cocos2d::UserDefault caused the SIGSEGV


Hello,

Do you remember how did you solve it? I’m running into the same problem (almost identical NDK stack crash dump) with Cocos2d-x 3.4 and Android SDK target 10 (2.3.x), tested with several Android devices with different versions. We’ve been using cocos2d::UserDefault since the beginning of the project, and now it just stopped working for Android (it does work on iOS).

Thank you in advance!