Skip to content

[v 3.11] crash on Android 2.3 #15891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
frranck opened this issue Jun 20, 2016 · 45 comments
Open

[v 3.11] crash on Android 2.3 #15891

frranck opened this issue Jun 20, 2016 · 45 comments

Comments

@frranck
Copy link

frranck commented Jun 20, 2016

Hi,
I have this crash on Android 2.3, though it's working fine on more recent android versions:

D/dalvikvm( 3020): Trying to load lib /mnt/asec/org.domain.APP-1/lib/libcocos2dcpp.so 0x405182e0
I/DEBUG ( 1307): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 1307): Build fingerprint: 'samsung/GT-S5360/GT-S5360:2.3.6/GINGERBREAD/XXLI2:user/release-keys'
I/DEBUG ( 1307): pid: 3020, tid: 3020 >>> org.domain.APP <<<
I/DEBUG ( 1307): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 8114a578
I/DEBUG ( 1307): r0 814e0e60 r1 813d7a11 r2 814d2000 r3 0000cec8
I/DEBUG ( 1307): r4 814e0e60 r5 00000051 r6 00000004 r7 00000000
I/DEBUG ( 1307): r8 80218200 r9 0000cec8 10 4428fbe8 fp bec067d0
I/DEBUG ( 1307): ip 814d1b60 sp bec063e8 lr 81418707 pc 8114a578 cpsr 20000030
I/DEBUG ( 1307): d0 3f8000003f800000 d1 3ff0000040000000
I/DEBUG ( 1307): d2 4d86be24424d2b93 d3 00540ff04a2c7880
I/DEBUG ( 1307): d4 3fbc71c7002b1e20 d5 3fcef049fb9094d1
I/DEBUG ( 1307): d6 401c000000000000 d7 3ff0000000000000
I/DEBUG ( 1307): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 1307): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 1307): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 1307): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 1307): scr 60000012
I/DEBUG ( 1307):
I/DEBUG ( 1307): #00 pc 0014a578 /mnt/asec/org.domain.APP-1/lib/libcocos2dcpp.so
I/DEBUG ( 1307): #1 lr 81418707 /mnt/asec/org.domain.APP-1/lib/libcocos2dcpp.so
I/DEBUG ( 1307):
I/DEBUG ( 1307): code around pc:
I/DEBUG ( 1307): 8114a558 00301bf9 00301bec 4c07b510 4620447c
I/DEBUG ( 1307): 8114a568 ffcaf28c 4a064905 44794620 447a6809
I/DEBUG ( 1307): 8114a578 4010e8bd ba12f289 003968f8 00385b3a
I/DEBUG ( 1307): 8114a588 00387a86 4c0eb538 447c4d0e 4620447d
I/DEBUG ( 1307): 8114a598 ffb2f28c 4620490c 462a4c0c 68094479
I/DEBUG ( 1307):
I/DEBUG ( 1307): code around lr:
I/DEBUG ( 1307): 814186e4 9908418b 600a1c30 1c39604b bdf0b003
I/DEBUG ( 1307): 814186f4 1c05b570 682c1c0e 19a11c2a 4b031c20
I/DEBUG ( 1307): 81418704 28004798 1c20d1f7 46c0bd70 ffff0fc0
I/DEBUG ( 1307): 81418714 1c05b570 682c1c0e 1ba11c2a 4b031c20
I/DEBUG ( 1307): 81418724 28004798 1c20d1f7 46c0bd70 ffff0fc0
I/DEBUG ( 1307):
I/DEBUG ( 1307): stack:
I/DEBUG ( 1307): bec063a8 4428fbe8
I/DEBUG ( 1307): bec063ac 813d752f /mnt/asec/org.domain.APP-1/lib/libcocos2dcpp.so
I/DEBUG ( 1307): bec063b0 afd116bc /system/lib/libc.so
I/DEBUG ( 1307): bec063b4 814e0e40
I/DEBUG ( 1307): bec063b8 814e0e54
I/DEBUG ( 1307): bec063bc 813d39b1 /mnt/asec/org.domain.APP-1/lib/libcocos2dcpp.so
I/DEBUG ( 1307): bec063c0 00000000
I/DEBUG ( 1307): bec063c4 80218200 /system/lib/libdvm.so
I/DEBUG ( 1307): bec063c8 0000cec8
I/DEBUG ( 1307): bec063cc 4428fbe8
I/DEBUG ( 1307): bec063d0 bec067d0
I/DEBUG ( 1307): bec063d4 814e0e60
I/DEBUG ( 1307): bec063d8 00000051
I/DEBUG ( 1307): bec063dc 00000004
I/DEBUG ( 1307): bec063e0 df002777
I/DEBUG ( 1307): bec063e4 e3a070ad
I/DEBUG ( 1307): #00 bec063e8 814b8f40
I/DEBUG ( 1307): bec063ec b00037f5 /system/bin/linker
I/DEBUG ( 1307): bec063f0 b000e1cc
I/DEBUG ( 1307): bec063f4 b000e1c8
I/DEBUG ( 1307): bec063f8 00002751
I/DEBUG ( 1307): bec063fc b00038a9 /system/bin/linker
I/DEBUG ( 1307): bec06400 004ee000
I/DEBUG ( 1307): bec06404 afd00000 /system/lib/libc.so
I/DEBUG ( 1307): bec06408 00000020
I/DEBUG ( 1307): bec0640c b000e0e8
I/DEBUG ( 1307): bec06410 814d0038
I/DEBUG ( 1307): bec06414 b000e0e8
I/DEBUG ( 1307): bec06418 00002751
I/DEBUG ( 1307): bec0641c b0004f93 /system/bin/linker
I/DEBUG ( 1307): bec06420 00000020
I/DEBUG ( 1307): bec06424 b000e174
I/DEBUG ( 1307): bec06428 b000e0e8
I/DEBUG ( 1307): bec0642c 00000008

how to troubleshout this ?

@frranck frranck changed the title crash on Android 2.3 [v 3.11] crash on Android 2.3 Jun 20, 2016
@ricardoquesada
Copy link
Contributor

ricardoquesada commented Jun 20, 2016

Please, add more info like:

  • device model
  • when does it crash? what code do you have to run in order to crash it?

The more info you add, the easier for us to reproduce it and fix it.

thanks.

@frranck
Copy link
Author

frranck commented Jun 21, 2016

@ricardoquesada It's a Samsung GT-S5360. running Android 2.3.6

It's crashing when launching the app, nothing special about it, except it is using SDKBOX/Facebook.

@ricardoquesada
Copy link
Contributor

@frranck
which app are you running? does it crash with the "test-cpp" app that is part of cocos2d-x?

if we can't reproduce the bug, we won't be able to fix it.

@frranck
Copy link
Author

frranck commented Jun 22, 2016

@ricardoquesada sorry this is very weird but I ran into some problems compiling the tests:

[armeabi] Compile++ thumb: cpp_tests_shared <= DownloaderTest.cpp
jni/../../Classes/ChipmunkTest/ChipmunkTest.cpp: In destructor 'virtual ChipmunkTest::~ChipmunkTest()':
jni/../../Classes/ChipmunkTest/ChipmunkTest.cpp:101:25: error: 'cpHastySpaceFree' was not declared in this scope
cpHastySpaceFree(_space);
^
jni/../../Classes/ChipmunkTest/ChipmunkTest.cpp: In member function 'void ChipmunkTest::initPhysics()':
jni/../../Classes/ChipmunkTest/ChipmunkTest.cpp:117:27: error: 'cpHastySpaceNew' was not declared in this scope
_space = cpHastySpaceNew();

@minggo
Copy link
Contributor

minggo commented Jun 23, 2016

@frranck did you have chipmunk in external?

@frranck
Copy link
Author

frranck commented Jun 23, 2016

@minggo thanks, I was missing the dependancies.
I'm now running into a problem with an "undefined reference to 'bsd_signal'", I guess It's because I'm using android-ndk-r11c, which version should I use ?

@minggo
Copy link
Contributor

minggo commented Jun 23, 2016

I also use r11c, and don't have a problem. Which project did you build?

@frranck
Copy link
Author

frranck commented Jun 23, 2016

@minggo I'm trying to build cpp-tests

@minggo
Copy link
Contributor

minggo commented Jun 29, 2016

@frranck any update?

@frranck
Copy link
Author

frranck commented Jun 29, 2016

@minggo No, I pull the latest cocos2d-x version and still can't compile the tests;
I'm running "python android-build.py -p 23 cpp-tests" and get this error:


[armeabi] SharedLibrary  : libcpp_tests.so
/Users/franck/cocos/cocos2d-x/tests/cpp-tests/proj.android/../../../external/websockets/prebuilt/android/armeabi/libwebsockets.a(lws-plat-unix.c.o):lws-plat-unix.c:function lws_plat_context_early_init: error: undefined reference to 'bsd_signal'
/Users/franck/cocos/cocos2d-x/tests/cpp-tests/proj.android/../../../external/websockets/prebuilt/android/armeabi/libwebsockets.a(lws-plat-unix.c.o):lws-plat-unix.c:function lws_plat_context_early_init: error: undefined reference to 'bsd_signal'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [obj/local/armeabi/libcpp_tests.so] Error 1
Error running command, return code: 2.

@minggo
Copy link
Contributor

minggo commented Jun 29, 2016

@frranck did you updated 3rd party libraries by using ./download-deps.py?

@frranck
Copy link
Author

frranck commented Jun 29, 2016

@minggo Yes I did that, and just did it again: same problem. :(

@minggo
Copy link
Contributor

minggo commented Jun 29, 2016

I just synchronized to v3, and run ./android-build.py -p 23 cpp-tests, there is not problem. I have not idea with the issue, but i think you can do the following and try again

  • remove tests/cpp-tests/proj.android/libs and tests/cpp-tests/proj.android/obj
  • remove all 3rd party libraries in external and run ./download-deps.py again

@frranck
Copy link
Author

frranck commented Jun 29, 2016

@minggo Just did the whole process you described and I still get the exact same error.

@minggo
Copy link
Contributor

minggo commented Jun 30, 2016

@frranck Sorry, i have no idea, the problem may be the deps is not correct, but you use ./download-deps.py to update it, so there should not problem.

@frranck
Copy link
Author

frranck commented Jul 2, 2016

@minggo that's weird, the 'undefined reference to 'bsd_signal' is mentioned here

If you run:

nm cocos/cocos2d-x/external/websockets/prebuilt/android/*/libwebsockets.a | grep -i bsd

Do you see that bsd_signal is used ?

     U bsd_signal
     U bsd_signal
     U bsd_signal

@minggo
Copy link
Contributor

minggo commented Jul 4, 2016

But i also use NDK r11c and don't have any problem.

@frranck
Copy link
Author

frranck commented Jul 5, 2016

@minggo OK so I gave up with the tests, and tried a new project
I can compile it but I've got a crash when running the app on a Samsung GT-S5360. running Android 2.3.6:

V/AudioFlinger( 1311): TrackBase::reset
W/dalvikvm( 5376): VFY: unable to resolve virtual method 248: Landroid/view/View;.setSystemUiVisibility (I)V
D/dalvikvm( 5376): VFY: replacing opcode 0x6e at 0x0010
D/dalvikvm( 5376): Trying to load lib /mnt/asec/com.MyCompany.MyGame-1/lib/libMyGame.so 0x40517e50
D/AndroidRuntime( 5376): Shutting down VM
W/dalvikvm( 5376): threadid=1: thread exiting with uncaught exception (group=0x40018578)
E/AndroidRuntime( 5301): FATAL EXCEPTION: main
E/AndroidRuntime( 5301): java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1312]: 1310 cannot locate ' abs'...
E/AndroidRuntime( 5301):
E/AndroidRuntime( 5301): at java.lang.Runtime.loadLibrary(Runtime.java:434)
E/AndroidRuntime( 5301): at java.lang.System.loadLibrary(System.java:554)
E/AndroidRuntime( 5301): at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:248)
E/AndroidRuntime( 5301): at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:264)
E/AndroidRuntime( 5301): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 5301): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
E/AndroidRuntime( 5301): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
E/AndroidRuntime( 5301): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 5301): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
E/AndroidRuntime( 5301): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 5301): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 5301): at android.app.ActivityThread.main(ActivityThread.java:3687)
E/AndroidRuntime( 5301): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 5301): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 5301): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
E/AndroidRuntime( 5301): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
E/AndroidRuntime( 5301): at dalvik.system.NativeStart.main(Native Method)
E/ ( 1495): Dumpstate > /data/log/dumpstate_app_error
V/AudioFlinger( 1311): Audio hardware entering standby, mixer 0x6ef38, mSuspended 0
D/AudioStreamOutALSA( 1311): AudioStreamOutALSA::standby--pause

@minggo
Copy link
Contributor

minggo commented Jul 6, 2016

@frranck does it crash on other devices? I will try to find a device with Android 2.3.6.

@frranck
Copy link
Author

frranck commented Jul 6, 2016

@minggo Yes It's working fine on a Moto G.

@minggo
Copy link
Contributor

minggo commented Jul 7, 2016

So it is device dependent, then it is more hard to fix.

@minggo
Copy link
Contributor

minggo commented Jul 7, 2016

@frranck about the bsd_signal error, i met it when i change the contents of tests/cpp-tests/proj.android/project.properties to target=19. I think it is because some symbols are removed in new Android OS version.

@frranck
Copy link
Author

frranck commented Jul 7, 2016

@minggo cocos2d-x v2 used to work on that device... Can you try on any Android 2.3.x device ?

@lfmn83
Copy link

lfmn83 commented Jul 8, 2016

I'm facing same issue reported on first comment. I'm testing on a Samsung GT-S5830C v2.3.6-GINGERBREAD with NDK-r10c. With v3.7 and NDK-r9d everything was ok for android 2.3 devices.

@minggo
Copy link
Contributor

minggo commented Jul 11, 2016

E/AndroidRuntime( 5301): java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1312]: 1310 cannot locate ' abs'...

@frranck I think i know the issue. Because abs defined in Android API 19 and lower is

static __inline__ int abs(int __n) {
    return (__n < 0) ? -__n : __n;
}

and defined in Android API 21 is

extern int abs(int) __pure2;

So if you build with Android API 20+, and run under Android 5.0(API 21), then it will have problem. If you want to fix your problem, then you can work around it by compiling with API 19 or lower. Of course, i will use std::abs instead of abs in cocos2d-x codes.

@minggo
Copy link
Contributor

minggo commented Jul 11, 2016

I send #16080 to fix it.

@minggo minggo added this to the 3.13 milestone Jul 11, 2016
@lfmn83
Copy link

lfmn83 commented Jul 11, 2016

I'm still getting same error for samsung/GT-S5830C/GT-S5830C:2.3.6/GINGERBREAD.

It could be a setSystemUiVisibility call? This method was added in API 11, and seems there is call when game starts. There is a setSystemUiVisibility in Cocos2dxActivity that was not executed and error happens before Cocos2dxActivity code.

Empty test for v3.12 with ndkr11c:

org.cocos2dx.cpp_empty_test W/dalvikvm: VFY: unable to resolve virtual method 249: Landroid/view/View;.setSystemUiVisibility (I)V
07-11 10:16:53.757 4499-4499/org.cocos2dx.cpp_empty_test D/dalvikvm: VFY: replacing opcode 0x6e at 0x0010
07-11 10:16:53.773 4499-4499/org.cocos2dx.cpp_empty_test I/ApplicationPackageManager: cscCountry is not German : ZTO
07-11 10:16:53.804 4499-4499/org.cocos2dx.cpp_empty_test D/dalvikvm: Trying to load lib /data/data/org.cocos2dx.cpp_empty_test/lib/libcpp_empty_test.so 0x4051af28
07-11 10:16:54.351 2327-2327/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-11 10:16:54.351 2327-2327/? I/DEBUG: Build fingerprint: 'samsung/GT-S5830C/GT-S5830C:2.3.6/GINGERBREAD/VJLK4:user/release-keys'
07-11 10:16:54.351 2327-2327/? I/DEBUG: pid: 4499, tid: 4499  >>> org.cocos2dx.cpp_empty_test <<<
07-11 10:16:54.351 2327-2327/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 7d74c720
07-11 10:16:54.351 2327-2327/? I/DEBUG:  r0 819d9fd4  r1 819da400  r2 7d74c6f8  r3 00000028
07-11 10:16:54.351 2327-2327/? I/DEBUG:  r4 000fe5c6  r5 7d74c720  r6 819d9fd4  r7 beba6378
07-11 10:16:54.351 2327-2327/? I/DEBUG:  r8 80218200  r9 0000cec8  10 44293c04  fp beba63f0
07-11 10:16:54.351 2327-2327/? I/DEBUG:  ip 81a1fea4  sp beba6378  lr 817248ba  pc 819218b0  cpsr 00000030
...
07-11 10:16:58.437 1557-1584/? W/WindowManager: App freeze timeout expired.
07-11 10:16:58.437 1557-1584/? W/WindowManager: Force clearing freeze: AppWindowToken{40b2ff88 token=HistoryRecord{4091c7a0 org.cocos2dx.cpp_empty_test/.AppActivity}}
07-11 10:16:58.453 1557-1584/? D/PowerManagerService: releaseWakeLock flags=0x1 tag=SCREEN_FROZEN

Log: log.txt

@minggo
Copy link
Contributor

minggo commented Jul 12, 2016

setSystemVisibility is invoked like this

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

            getWindow().getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
                            | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
        }

As you can see, it is only executed when Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT. So i don't know why the codes are executed because your system is 2.3.6.

@lfmn83
Copy link

lfmn83 commented Jul 12, 2016

Yes, this code in Cocos2dActivity is not executed. I don't know why there is an error before Cocos2dActivity code being executed.

@frranck
Copy link
Author

frranck commented Jul 12, 2016

@minggo just to confirm: #16080 fixed the compilation issue, but I still get the crash...

@lfmn83
Copy link

lfmn83 commented Jul 12, 2016

I tested with NDK-r9d and NDK-r10c. There are a lot of warnings and my game is very buggy with both, but I can generate apk file and run it. There is also VFY: unable to resolve virtual method 9077: Landroid/view/View;.setSystemUiVisibility (I)V message, so this message is not the problem.

@minggo
Copy link
Contributor

minggo commented Jul 13, 2016

@frranck what's the error message? Do you have the crash log?

@lfmn83 yep, it is not a problem.

@frranck
Copy link
Author

frranck commented Jul 13, 2016

@minggo Sorry I got confused, there was no compilation issue, and I still get the "cannot locate
abs" error with the "MyCompany/MyGame" test example.
But it is using android-23, should I try android-19 ? What is the proper way to change this ?

@minggo
Copy link
Contributor

minggo commented Jul 13, 2016

@frranck did you apply my commit?

@frranck
Copy link
Author

frranck commented Jul 13, 2016

@minggo I did a git pull in cocos2d-x, isn't it in master already ?

@minggo
Copy link
Contributor

minggo commented Jul 13, 2016

@frranck yep, it is merged into v3 branch. It is strange, there is not codes using abs except bullet, did you use bullet?

And are you sure your game used correct engine since new project will copy engine.

@ryanxia2016
Copy link

ryanxia2016 commented Jul 13, 2016

We update cocos2dx to today's latest git clone version( with #16080 fixed). + NDK R10E
Found Crash on 2.3.6 SAMSUNG GT-S5830i
After rollback to old version, the crash disappear.

@ryanxia2016
Copy link

ryanxia2016 commented Jul 13, 2016

try and try...
before I gave up
I switched the NDK from R10E to R9D
it works.... no crash any more...

@minggo any comments?

@frranck
Copy link
Author

frranck commented Jul 13, 2016

@minggo Just created a new app, still get the "abs" crash.

@minggo
Copy link
Contributor

minggo commented Jul 22, 2016

I tried HTC Sense 2.3.7, no crash.

@minggo minggo modified the milestones: next, 3.13 Aug 1, 2016
@minggo
Copy link
Contributor

minggo commented Aug 3, 2016

bsd_signal issue is fixed in #16267

@minggo minggo removed this from the 3.14 milestone Oct 9, 2016
@minggo
Copy link
Contributor

minggo commented Oct 9, 2016

Is there any crash in newest version? I will close this issue since i think they are fixed.

@minggo minggo closed this as completed Oct 9, 2016
@frranck
Copy link
Author

frranck commented Oct 9, 2016

@minggo I don't have the phone to test at the moment, but I've never seen this fixed... Could anyone here test it ?

@frranck
Copy link
Author

frranck commented Nov 20, 2016

@minggo I just did the test with cocos2d-x-3.13.1 and it stills crashes. Could we please reopen this bug ?

@minggo minggo reopened this Nov 21, 2016
@minggo
Copy link
Contributor

minggo commented Nov 21, 2016

@frranck could you please provide a test case? And please describe your environments:

  • NDK version
  • Android target version built with(value of --ap)
  • device test on and it Android OS versoin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants