[Solved] Android App crashes at start

Hi,

i recently ported a quite big flash game to html5 using lime, which now works perfectly fine ( Mars Tomorrow ). Now i’m trying to create an android app. I did a small test project: getting haxe to build a android app was a bit tricky, but it worked. BUT, wenn i try to build the big game for android, the app instantly crashes. It crashs before the first trace in the main class contructor is executed. I was not able to create a debug build, because it runs out of memory :confused:
I got it working when i remove all imports in the main class, so it stops working when i import the wrong hx files.
I works fine for html5, neko and windows.

Does anyone have an idea what is going wrong or what i can do to fix that?

Logcat:
> --------- beginning of main
> 2019-03-28 08:29:57.678 967-967/? W/[email protected]: type=1400 audit(0.0:122277): avc: denied { read } for uid=1000 name=“mem” dev=“debugfs” ino=46529 scontext=u:r:hal_memtrack_default:s0 tcontext=u:object_r:qti_debugfs:s0 tclass=file permissive=0
> 2019-03-28 08:29:57.698 1644-3908/? I/ActivityManager: Config changes=480 {1.0 262mcc2mnc [de_DE] ldltr sw360dp w592dp h336dp 640dpi nrml widecg land finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 2368, 1440) s.49 spn11 gid11}
> 2019-03-28 08:29:57.711 1644-3908/? I/ActivityManager: Override config changes=480 {1.0 262mcc2mnc [de_DE] ldltr sw360dp w592dp h336dp 640dpi nrml widecg land finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 2368, 1440) s.49 spn11 gid11} for displayId=0
> 2019-03-28 08:29:57.717 2477-2477/? I/KeyboardViewUtil: systemKeyboardHeightRatio:1.000000; userKeyboardHeightRatio:1.000000.
> 2019-03-28 08:29:57.719 2663-11329/? D/ProcSpeedReader: Failed to read freq stats from null
> 2019-03-28 08:29:57.729 1644-2425/? I/InputReader: Reconfiguring input devices. changes=0x00000004
> 2019-03-28 08:29:57.729 1644-2425/? I/InputReader: Device reconfigured: id=8, name=‘synaptics_dsx_i2c’, size 1440x2560, orientation 1, mode 1, display id 0
> 2019-03-28 08:29:57.745 2477-2477/? I/DeviceStatusMonitor: onReceive() : Action = android.intent.action.CONFIGURATION_CHANGED
> 2019-03-28 08:29:57.754 1644-2425/? I/InputReader: Reconfiguring input devices. changes=0x00000004
> 2019-03-28 08:29:57.762 8962-8962/? V/SDL: Device: nash
> 2019-03-28 08:29:57.762 8962-8962/? V/SDL: Model: Moto Z (2)
> 2019-03-28 08:29:57.762 8962-8962/? V/SDL: onCreate()
> 2019-03-28 08:29:57.763 8962-8962/? W/linker: /data/app/de.gamefab.mars-gBZFA-oxrOXIW4BS9uJ0WA==/lib/arm/liblime.so: is missing DT_SONAME will use basename as a replacement: “liblime.so”
> 2019-03-28 08:29:57.765 8962-8962/? W/SDL: Request to get environment variables before JNI is ready
> 2019-03-28 08:29:57.766 8962-8962/? W/linker: /data/app/de.gamefab.mars-gBZFA-oxrOXIW4BS9uJ0WA==/lib/arm/libApplicationMain.so: is missing DT_SONAME will use basename as a replacement: “libApplicationMain.so”
> 2019-03-28 08:29:57.771 8962-8962/? V/SDL: nativeSetupJNI()
> 2019-03-28 08:29:57.771 8962-8962/? V/SDL: AUDIO nativeSetupJNI()
> 2019-03-28 08:29:57.771 8962-8962/? V/SDL: CONTROLLER nativeSetupJNI()
> 2019-03-28 08:29:57.775 1644-2425/? I/InputReader: Reconfiguring input devices. changes=0x00000004
> 2019-03-28 08:29:57.786 2491-2586/? I/NetworkController: handleConfigurationChanged – mcc/mnc for sub: {id=1, iccId=894920171[****] simSlotIndex=0 displayName=SIM 1 carrierName=kein Dienst nameSource=0 iconTint=-16746133 dataRoaming=0 iconBitmap=android.graphics.Bitmap@1ce92a0 mcc 262 mnc 2 status 0}
> 2019-03-28 08:29:57.787 8962-8962/? V/SDL: onResume()
> 2019-03-28 08:29:57.800 8962-8991/? D/OpenGLRenderer: HWUI GL Pipeline
> 2019-03-28 08:29:57.824 8962-8991/? I/Adreno: QUALCOMM build : 076f837, I801ffd6741
> Build Date : 10/24/17
> OpenGL ES Shader Compiler Version: EV031.20.00.04
> Local Branch :
> Remote Branch :
> Remote Branch :
> Reconstruct Branch :
> 2019-03-28 08:29:57.828 8962-8991/? I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.msm8998.so from the current namespace instead.
> 2019-03-28 08:29:57.834 8962-8991/? I/Adreno: PFP: 0x005ff087, ME: 0x005ff063
> 2019-03-28 08:29:57.837 8962-8991/? I/OpenGLRenderer: Initialized EGL, version 1.4
> 2019-03-28 08:29:57.838 8962-8991/? D/OpenGLRenderer: Swap behavior 2
> 2019-03-28 08:29:57.848 8962-8962/? V/SDL: surfaceCreated()
> 2019-03-28 08:29:57.848 8962-8962/? V/SDL: surfaceChanged()
> 2019-03-28 08:29:57.848 8962-8962/? V/SDL: pixel format RGB_565
> 2019-03-28 08:29:57.849 8962-8962/? V/SDL: Window size: 2368x1344
> 2019-03-28 08:29:57.852 8962-8962/? V/SDL: nativeResume()
> 2019-03-28 08:29:57.852 8962-8992/? V/SDL: Running main function hxcpp_main from library libApplicationMain.so
> 2019-03-28 08:29:57.852 8962-8992/? V/SDL: nativeRunMain()
> 2019-03-28 08:29:57.853 8962-8962/? V/SDL: onWindowFocusChanged(): true
> 2019-03-28 08:29:57.860 8962-8992/? I/haxe plugin: Got Load Proc d0b0bce8
> 2019-03-28 08:29:57.866 2491-2491/? V/ImsIconController: updateIMS: intent: Intent { act=android.intent.action.CONFIGURATION_CHANGED flg=0x70200010 }
> 2019-03-28 08:29:57.869 2491-2491/? V/ImsIconController: updateIMS: registered over LTE: false, registered over WIFI: false, icon enabled: false, DDS subID: 1
>
> --------- beginning of crash
> 2019-03-28 08:29:57.871 8962-8992/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x60c in tid 8992 (SDLThread)
> 2019-03-28 08:29:57.876 8962-8991/? I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.msm8998.so from the current namespace instead.
> 2019-03-28 08:29:57.890 2491-2491/? D/StatusBar: disable
> 2019-03-28 08:29:57.898 8999-8999/? I/crash_dump32: obtaining output fd from tombstoned
> 2019-03-28 08:29:57.898 1236-1236/? I//system/bin/tombstoned: received crash request for pid 8962
> 2019-03-28 08:29:57.901 8999-8999/? I/crash_dump32: performing dump of process 8962 (target tid = 8992)
> 2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
> 2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: Build fingerprint: ‘motorola/nash/nash:8.0.0/OPXS27.109-34-19/19:user/release-keys’
> 2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: Revision: ‘pvt’
> 2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: ABI: ‘arm’
> 2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: pid: 8962, tid: 8992, name: SDLThread >>> de.gamefab.mars <<<
> 2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x60c
> 2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: Cause: null pointer dereference
> 2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: r0 00007f00 r1 00000180 r2 00000060 r3 00000000
> 2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: r4 cf52f900 r5 00000000 r6 000122f0 r7 e3094300
> 2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: r8 00000000 r9 00000001 sl d0ef2c78 fp d0ef2c78
> 2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: ip 00000000 sp cf8c0f98 lr 00000001 pc d0b16e58 cpsr 600f0010
> 2019-03-28 08:29:57.902 8999-8999/? A/DEBUG: backtrace:
> 2019-03-28 08:29:57.902 8999-8999/? A/DEBUG: #00 pc 00d66e58 /data/app/de.gamefab.mars-gBZFA-oxrOXIW4BS9uJ0WA==/lib/arm/libApplicationMain.so
> 2019-03-28 08:29:57.902 8999-8999/? A/DEBUG: #01 pc 00c7fa0c /data/app/de.gamefab.mars-gBZFA-oxrOXIW4BS9uJ0WA==/lib/arm/libApplicationMain.so
> 2019-03-28 08:29:57.902 8999-8999/? A/DEBUG: #02 pc 00d55f94 /data/app/de.gamefab.mars-gBZFA-oxrOXIW4BS9uJ0WA==/lib/arm/libApplicationMain.so
> 2019-03-28 08:29:57.902 8999-8999/? A/DEBUG: #03 pc 00d564dc /data/app/de.gamefab.mars-gBZFA-oxrOXIW4BS9uJ0WA==/lib/arm/libApplicationMain.so (hxcpp_main+32)
> 2019-03-28 08:29:57.902 8999-8999/? A/DEBUG: #04 pc 00467af0 /data/app/de.gamefab.mars-gBZFA-oxrOXIW4BS9uJ0WA==/lib/arm/liblime.so (Java_org_libsdl_app_SDLActivity_nativeRunMain+508)
> 2019-03-28 08:29:57.902 8999-8999/? A/DEBUG: #05 pc 00002899 /data/app/de.gamefab.mars-gBZFA-oxrOXIW4BS9uJ0WA==/oat/arm/base.odex (offset 0x2000)

2019-03-28 08:29:57.901 8999-8999/? A/DEBUG: Cause: null pointer dereference

Do you use reflection in code? Do you use -final, -dce full or -D HXCPP_GC_GENERATIONAL flags in build command?

I works fine for … windows.

Ok, don’t mind.

Is it physical device or an emulator? Did you try other devices?

It crashes on my available devices, Moto Z2 and an old amazon fire tablet :confused:

One more question: what NDK version do you use?
I remember the case with r10, when GCC messed with variable declarations, so they were prematurely GC’d.
Try NDK r15c.

I already use 15.2.4203891 :expressionless:

Ok, just to investigate it
could you compile with -D toolchain=mingw, -D mingw for windows? Just want to make sure if it’s GCCs fault.
Did you use as3hx?

Thx for your help! I said, it worked for windows, but i just tried again and it failed with a similiar behaviour. Debugging here was much more easy, and it failed creating a very very large static dynamic object ( the game localisation data in all languages - maybe not the best idea ).

so again, thanks a lot :slight_smile:

Can you try a standard OpenFL sample on your device?

Then if it works – can you try putting a return at the start of your Main class and see if it reaches a blank screen without crashing?

Hi, basicially all works. The problem was a very big dynamic object, which was defined as a static class member. Including this class caused the crash. It even crashes when i load the file as string and try to parse it as a json ( 700kb, 14k lines ).
Looks like i have to rework the whole thing.

Thx