JNI DETECTED ERROR IN APPLICATION: cannot call void android.view.View.setTranslationZ (float) on null object

I have a complicated application and this error occurs when I click on a button that launches two views for display through FadeIn- and TranslateX-animations. Views were loaded before and were also inserted into the layout (as invisible). Later, when I start the application, I press the button and an error appears.

Here's the stacktrace:

11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: can't call void android.view.View.setTranslationZ(float) on null object 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] in call to CallVoidMethodV 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] from void android.animation.PropertyValuesHolder.nCallFloatMethod(java.lang.Object, long, float) 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] | group="main" sCount=0 dsCount=0 obj=0x87394ef0 self=0xb4e08000 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] | sysTid=29902 nice=0 cgrp=apps sched=0/0 handle=0xb6f18ec8 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] | state=R schedstat=( 12655665356 2452371955 8477 ) utm=1045 stm=220 core=0 HZ=100 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] | stack=0xbe53f000-0xbe541000 stackSize=8MB 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] | held mutexes= "mutator lock"(shared held) 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] native: #00 pc 00004640 /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23) 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] native: #01 pc 00002e8d /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8) 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] native: #02 pc 00245eb1 /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+68) 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] native: #03 pc 0022ad0f /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+146) 11-07 10:42:08.986 F/art (29902): sart/runtime/check_jni.cc:65] native: #04 pc 000b0beb /system/lib/libart.so (art::JniAbort(char const*, char const*)+582) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] native: #05 pc 000b1325 /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] native: #06 pc 000b1601 /system/lib/libart.so (art::ScopedCheck::CheckVirtualMethod(_jobject*, _jmethodID*)+408) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] native: #07 pc 000bb917 /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+70) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] native: #08 pc 00063303 /system/lib/libandroid_runtime.so (???) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] native: #09 pc 00071e8d /system/framework/arm/boot.oat (Java_android_animation_PropertyValuesHolder_nCallFloatMethod__Ljava_lang_Object_2JF+132) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.animation.PropertyValuesHolder.nCallFloatMethod(Native method) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.animation.PropertyValuesHolder.access$400(PropertyValuesHolder.java:38) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.animation.PropertyValuesHolder$FloatPropertyValuesHolder.setAnimatedValue(PropertyValuesHolder.java:1296) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:952) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.animation.ValueAnimator.animationFrame(ValueAnimator.java:1207) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1248) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:659) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:682) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.view.Choreographer.doCallbacks(Choreographer.java:590) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.view.Choreographer.doFrame(Choreographer.java:559) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.os.Handler.handleCallback(Handler.java:739) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.os.Handler.dispatchMessage(Handler.java:95) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.os.Looper.loop(Looper.java:145) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at android.app.ActivityThread.main(ActivityThread.java:6066) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at java.lang.reflect.Method.invoke!(Native method) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at java.lang.reflect.Method.invoke(Method.java:372) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388) referenceTable GDEF length=778 1 referenceTable GSUB length=6388 1 referenceTable GPOS length=66796 1 referenceTable GDEF length=372 1 referenceTable GSUB length=17802 1 referenceTable GPOS length=89498 1 referenceTable GSUB length=11222 1 referenceTable GPOS length=9574 1 referenceTable head length=54 1 referenceTable GDEF length=22 1 referenceTable GSUB length=1206 1 referenceTable GPOS length=12 1 referenceTable GSUB length=11222 1 referenceTable GPOS length=9574 1 referenceTable head length=54 1 referenceTable head length=54 1 referenceTable GSUB length=14200 1 referenceTable GPOS length=26192 1 referenceTable head length=54 1 referenceTable GSUB length=11222 1 referenceTable GPOS length=9574 1 referenceTable head length=54 1 referenceTable GSUB length=11222 1 referenceTable GPOS length=9574 1 referenceTable head length=54 1 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183) 11-07 10:42:08.996 F/art (29902): sart/runtime/check_jni.cc:65] 

The strange thing about this is that the appearance of this error is highly dependent on the built-in code base. If I comment out a line (for example, only one of the views is animated or the method is called on one of the views), this does not happen. For instance. I stumbled upon this error a while ago, changed the layout a bit, this did not happen anymore, and now it is back. Also, it depends on the device !? It appeared in the emulator, but now it only appeared on my Samsung S5 device (API 21, Forms 2.3.3-pre4). But if an error occurs, it happens as a result of the same action every time (first click on the same button).

SetTranslationZ, as I understand it, is responsible for setting the index of the depth of representation of the parent in it. However, I do not change this.

Can someone point me in the direction of what else I can try? Is it possible to display a view while remaining in the parent RelativeLayout, but invisible?

+5
source share

Source: https://habr.com/ru/post/1259399/


All Articles