Repository navigation
NG Android (using Button) crashes with SIGABRT on API Level 21 #4256
Description
Activity
- changed the title
[-]Android crashes with SIGABRT on API Level 21[/-][+]NG Android (using Button) crashes with SIGABRT on API Level 21[/+]on May 23, 2017 @buuhuu we will try to isolate this case but still without an application to reproduce the error it will hard to uncover what is actually happening. If you can provide a simplified test case which reproduces the thrown error it would be of great help.
I have to clarify if we can handle that via enterprise support. It's not reproducible using a simple sample application.
Hi @buuhuu
We appreciate you digging into this issue!
As a clarification theAPILEVEL >= 21check is there because thesetStateListAnimatordoes not exist in pervious versions of android. That said, this issue might be a result of a code that is fixed in latter versions of android (>21).Do you think that there is another way to secure that the concurrency issue you explained does not happen in API 21 - perhaps canceling any pending animations for this view?
In any case, managing to reproduce this issue in a unit test or in a test-app will allow us to make sure that any change in the NativeScript code, fixes the problem. If you have such example/app it would be useful.
Closing this issue due to inactivity.
@buuhuu if you have a sample app or unit test that can reproduce this do let us know so we can test it on our side and reopen & relabel this issue.
Still actual for android 5.0.1 (API 21)
Here's log:A/art: art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: can't call void android.view.View.setTranslationZ(float) on null object art/runtime/check_jni.cc:65] in call to CallVoidMethodV art/runtime/check_jni.cc:65] from void android.animation.PropertyValuesHolder.nCallFloatMethod(java.lang.Object, long, float) art/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable art/runtime/check_jni.cc:65] | group="main" sCount=0 dsCount=0 obj=0x75079000 self=0xb7f0b090 art/runtime/check_jni.cc:65] | sysTid=31474 nice=0 cgrp=default sched=0/0 handle=0xb6fd9ec8 art/runtime/check_jni.cc:65] | state=R schedstat=( 24467293580 344405388 3761 ) utm=2343 stm=103 core=0 HZ=100 art/runtime/check_jni.cc:65] | stack=0xbe6f5000-0xbe6f7000 stackSize=8MB art/runtime/check_jni.cc:65] | held mutexes= "mutator lock"(shared held) art/runtime/check_jni.cc:65] native: #00 pc 00004c58 /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23) art/runtime/check_jni.cc:65] native: #01 pc 000034c1 /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8) art/runtime/check_jni.cc:65] native: #02 pc 002458bd /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+68) art/runtime/check_jni.cc:65] native: #03 pc 0022acaf /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+146) art/runtime/check_jni.cc:65] native: #04 pc 000b00ef /system/lib/libart.so (art::JniAbort(char const*, char const*)+582) art/runtime/check_jni.cc:65] native: #05 pc 000b081f /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+58) art/runtime/check_jni.cc:65] native: #06 pc 000b1239 /system/lib/libart.so (art::ScopedCheck::CheckVirtualMethod(_jobject*, _jmethodID*)+404) art/runtime/check_jni.cc:65] native: #07 pc 000bab8b /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+70) art/runtime/check_jni.cc:65] native: #08 pc 00062e8f /system/lib/libandroid_runtime.so (???) art/runtime/check_jni.cc:65] native: #09 pc 0007156d /data/dalvik-cache/arm/system@framework@boot.oat (Java_android_animation_PropertyValuesHolder_nCallFloatMethod__Ljava_lang_Object_2JF+132) art/runtime/check_jni.cc:65] at android.animation.PropertyValuesHolder.nCallFloatMethod(Native method) art/runtime/check_jni.cc:65] at android.animation.PropertyValuesHolder.access$400(PropertyValuesHolder.java:38) art/runtime/check_jni.cc:65] at android.animation.PropertyValuesHolder$FloatPropertyValuesHolder.setAnimatedValue(PropertyValuesHolder.java:1296) art/runtime/check_jni.cc:65] at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:952) art/runtime/check_jni.cc:65] at android.animation.ValueAnimator.animationFrame(ValueAnimator.java:1207) art/runtime/check_jni.cc:65] at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1248) art/runtime/check_jni.cc:65] at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:659) art/runtime/check_jni.cc:65] at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:682) art/runtime/check_jni.cc:65] at android.view.Choreographer$CallbackRecord.run(Choreographer.java:795) art/runtime/check_jni.cc:65] at android.view.Choreographer.doCallbacks(Choreographer.java:598) art/runtime/check_jni.cc:65] at android.view.Choreographer.doFrame(Choreographer.java:566) art/runtime/check_jni.cc:65] at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:781) art/runtime/check_jni.cc:65] at android.os.Handler.handleCallback(Handler.java:810) art/runtime/check_jni.cc:65] at android.os.Handler.dispatchMessage(Handler.java:99) art/runtime/check_jni.cc:65] at android.os.Looper.loop(Looper.java:189) art/runtime/check_jni.cc:65] at android.app.ActivityThread.main(ActivityThread.java:5529) art/runtime/check_jni.cc:65] at java.lang.reflect.Method.invoke!(Native method) art/runtime/check_jni.cc:65] at java.lang.reflect.Method.invoke(Method.java:372) art/runtime/check_jni.cc:65] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950) art/runtime/check_jni.cc:65] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745) art/runtime/check_jni.cc:65] A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 31474 (ipt.syrexsurvey)Fix
APILEVEL > 21didn't helped.
But I removed css classbtn-outlinefrom all Button elements and now it works!!!@NickIliev the issue needs to be reopened. Reproduced by (Android 5):
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'ns-outline-bug', moduleId: module.id, template: ` <GridLayout class="page"> <Button *ngIf="showButton" class="btn btn-outline" text="Buggy button" ></Button> </GridLayout> ` }) export class BuggyComponent implements OnInit { public showButton: boolean; constructor() {} ngOnInit(): void { setTimeout(() => { this.showButton = true; }, 2000); } }
EDIT:
F/art (32096): sart/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: can't call void android.view.View.setTranslationZ(float) on null object F/art (32096): sart/runtime/check_jni.cc:65] in call to CallVoidMethodV F/art (32096): sart/runtime/check_jni.cc:65] from void android.animation.PropertyValuesHolder.nCallFloatMethod(java.lang.Object, long, float)A temporary fix is either to remove
btn btn-outline(not sure ifbtnaffects it), or change*ngIfto[visibility]="condition ? 'visible' : 'collapse'".The method should obviously check for null before trying to set
TranslationZReacted by Nikolay IlievReopening the issue as it is fully reproducible on device/emulator with API 21 - use this playground to reproduce.
Hello NativeScript team!, i have that issue too, for me in my own class type, the css property that was causing the problem was z-index, that get in trouble when the element has involve in some ng tag of Angular!
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:
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
targetproperty is properly attached to the ObjectAnimator but oncesetNativeis 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 > 21instead ofAPILEVEL >= 21which 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.