应用程序中的JNI DETECTED ERROR:无法在空对象

时间:2016-11-07 10:29:20

标签: android animation xamarin xamarin.forms

我有一个复杂的应用程序,当点击按钮触发两个视图通过FadeIn-和TranslateX-动画出现时出现此错误。视图已在之前加载并且也已插入到布局中(作为不可见)。在运行应用程序时,我点击按钮,出现错误。

这是堆栈跟踪:

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] 

关于这一点的奇怪之处在于,此错误的出现在很大程度上取决于构建的代码库。如果我注释掉一行(例如,只有一个视图被动画化,或方法调用其中一个视图),它就不会发生。例如。我不久前偶然发现了这个错误,改变了布局,它不再发生了,现在又回来了。此外,它似乎依赖于设备!?它出现在模拟器中,但现在它只出现在我的Samsung S5设备上(API 21,Forms 2.3.3-pre4)。但是如果发生错误,则每次都会发生相同的操作(首先点击相同的按钮)。

据我所知,

SetTranslationZ负责在其父级中设置视图的深度索引。但是我并没有故意改变这一点。

有人能指出我可以尝试的其他方向吗?视图是否可以处理,同时仍然在父母的RelativeLayout中但是不可见?

0 个答案:

没有答案