反应原生的Android应用程序崩溃

时间:2017-02-24 12:01:39

标签: android react-native react-native-android

我在使用以下调用堆栈的反应原生Android应用程序中遇到崩溃

02-24 12:38:35.799 2878-2878/com.myapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                             Process: com.myapp, PID: 2878
                                                             java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.unFocus(android.view.View)' on a null object reference
                                                                 at android.view.ViewGroup.removeViewsInternal(ViewGroup.java:4300)
                                                                 at android.view.ViewGroup.removeViewsInLayout(ViewGroup.java:4156)
                                                                 at com.facebook.react.views.view.ReactViewGroup.updateSubviewClipStatus(ReactViewGroup.java:307)
                                                                 at com.facebook.react.views.view.ReactViewGroup.updateClippingToRect(ReactViewGroup.java:283)
                                                                 at com.facebook.react.views.view.ReactViewGroup.updateClippingRect(ReactViewGroup.java:276)
                                                                 at com.facebook.react.views.scroll.ReactScrollView.updateClippingRect(ReactScrollView.java:220)
                                                                 at com.facebook.react.views.scroll.ReactScrollView.onScrollChanged(ReactScrollView.java:152)
                                                                 at android.widget.ScrollView.onOverScrolled(ScrollView.java:801)
                                                                 at com.facebook.react.views.scroll.ReactScrollView.onOverScrolled(ReactScrollView.java:341)
                                                                 at android.view.View.overScrollBy(View.java:18607)
                                                                 at android.widget.ScrollView.computeScroll(ScrollView.java:1293)
                                                                 at android.view.View.updateDisplayListIfDirty(View.java:14154)
                                                                 at android.view.View.getDisplayList(View.java:14189)
                                                                 at android.view.View.draw(View.java:14959)
                                                                 at android.view.ViewGroup.drawChild(ViewGroup.java:3405)
                                                                 at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
                                                                 at android.view.View.draw(View.java:15234)
                                                                 at android.view.View.updateDisplayListIfDirty(View.java:14167)
                                                                 at android.view.View.getDisplayList(View.java:14189)
                                                                 at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
                                                                 at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
                                                                 at android.view.View.updateDisplayListIfDirty(View.java:14127)
                                                                 at android.view.View.getDisplayList(View.java:14189)
                                                                 at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
                                                                 at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
                                                                 at android.view.View.updateDisplayListIfDirty(View.java:14127)
                                                                 at android.view.View.getDisplayList(View.java:14189)
                                                                 at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
                                                                 at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
                                                                 at android.view.View.updateDisplayListIfDirty(View.java:14127)
                                                                 at android.view.View.getDisplayList(View.java:14189)
                                                                 at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
                                                                 at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
                                                                 at android.view.View.updateDisplayListIfDirty(View.java:14127)
                                                                 at android.view.View.getDisplayList(View.java:14189)
                                                                 at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
                                                                 at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
                                                                 at android.view.View.updateDisplayListIfDirty(View.java:14127)
                                                                 at android.view.View.getDisplayList(View.java:14189)
                                                                 at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
                                                                 at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
                                                                 at android.view.View.updateDisplayListIfDirty(View.java:14127)
                                                                 at android.view.View.getDisplayList(View.java:14189)
                                                                 at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
                                                                 at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
                                                                 at android.view.View.updateDisplayListIfDirty(View.java:14127)
                                                                 at android.view.View.getDisplayList(View.java:14189)
                                                                 at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
                                                                 at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
                                                                 at android.view.View.updateDisplayListIfDirty(View.java:14127)
                                                                 at android.view.View.getDisplayList(View.java:14189)
                                                                 at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
                                                                 at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
                                                                 at android.view.View.updateDisplayListIfDirty(View.java:14127)
                                                                 at android.view.View.getDisplayList(View.java:14189)
                                                                 at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:273)
                                                                at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:279
02-24 12:38:43.283 2878-2878/com.myapp I/Process: Sending signal. PID: 2878 SIG: 9

中止是间歇性的,没有固定的步骤来重现。如果其他人在Android上遇到类似的崩溃,请分享您是否有更多信息。

谢谢!

1 个答案:

答案 0 :(得分:0)

这是ListView的一个已知问题:

  

将ListView的removeClippedSubviews设置为false可以防止崩溃

https://github.com/facebook/react-native/issues/11825