Skip to content

NG Android (using Button) crashes with SIGABRT on API Level 21 #4256

@buuhuu

Description

@buuhuu

We faced the issue that our App crashes on Android 5.0 where it is working fine on Android 4.2 and higher versions. I cannot reproduce that on a sample app but here are the crash details:

F/libc    ( 3228): Fatal signal 6 (SIGABRT), code -6 in tid 3228 (eisen.piazza.nc)
I/DEBUG   ( 1163): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   ( 1163): Build fingerprint: 'generic_x86_64/sdk_google_phone_x86_64/generic_x86_64:5.0.2/LSY66K/3729068:eng/test-keys'
I/DEBUG   ( 1163): Revision: '0'
I/DEBUG   ( 1163): ABI: 'x86'
I/DEBUG   ( 1163): pid: 3228, tid: 3228, name: eisen.piazza.nc  >>> ch.myapp.nc <<<
I/DEBUG   ( 1163): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
I/DEBUG   ( 1163): Abort message: 'art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: can't call void android.view.View.setTranslationZ(float) on null object'
I/DEBUG   ( 1163):     eax 00000000  ebx 00000c9c  ecx 00000c9c  edx 00000006
I/DEBUG   ( 1163):     esi f7756f08  edi 00000002
I/DEBUG   ( 1163):     xcs 00000023  xds 0000002b  xes 0000002b  xfs 00000007  xss 0000002b
I/DEBUG   ( 1163):     eip f76c4446  ebp 00000c9c  esp ff7fe380  flags 00200286
I/DEBUG   ( 1163): 
I/DEBUG   ( 1163): backtrace:
I/DEBUG   ( 1163):     #00 pc 00075446  /system/lib/libc.so (tgkill+22)
I/DEBUG   ( 1163):     #01 pc 00021b1b  /system/lib/libc.so (pthread_kill+155)
I/DEBUG   ( 1163):     #02 pc 00023394  /system/lib/libc.so (raise+36)
I/DEBUG   ( 1163):     #03 pc 0001b874  /system/lib/libc.so (abort+84)
I/DEBUG   ( 1163):     #04 pc 003735e6  /system/lib/libart.so (art::Runtime::Abort()+294)
I/DEBUG   ( 1163):     #05 pc 000ec304  /system/lib/libart.so (art::LogMessage::~LogMessage()+1668)
I/DEBUG   ( 1163):     #06 pc 00101598  /system/lib/libart.so (art::JniAbort(char const*, char const*)+1656)
I/DEBUG   ( 1163):     #07 pc 00101ecc  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+108)
I/DEBUG   ( 1163):     #08 pc 00102308  /system/lib/libart.so (art::ScopedCheck::CheckVirtualMethod(_jobject*, _jmethodID*)+504)
I/DEBUG   ( 1163):     #09 pc 00112cdf  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, char*)+143)
I/DEBUG   ( 1163):     #10 pc 000754c9  /system/lib/libandroid_runtime.so (_JNIEnv::CallVoidMethod(_jobject*, _jmethodID*, ...)+41)
I/DEBUG   ( 1163):     #11 pc 0011f059  /system/lib/libandroid_runtime.so
I/DEBUG   ( 1163):     #12 pc 00089646  /data/dalvik-cache/x86/system@framework@boot.oat

I traced that down to be related to the android.view.Button(). It is instantiated using the default constructor which uses the default style which in turn sets the StateListAnimator of the View. At that point the target property is properly attached to the ObjectAnimator but once setNative is invoked and with it button.android.ts#L117 the StateListAnimator is set to null and with it the target of the ObjectAnimator. This is the causing the error in the Thread handling the animation.

In my application I patched tns-core-modules/ui/button.android.js to use APILEVEL > 21 instead of APILEVEL >= 21 which resolves the crash though its not the root cause I think.

I think that on Button instantiation the animation is queued as pending animation in another thread while setNative is called and resets the target of the ObjectAnimator on the UI thread. A better approach then calling setStateListAnimator(null) would be to instantiate the Button with a style and define it in the style so it is already set to null at instantiation time.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions