java.lang.NullPointerException:尝试调用虚拟方法“ float android.view.InputDevice $MotionRange.getMin()”

每次单击窗口小部件时,我都会收到以下错误:

java.lang.NullPointerException: Attempt to invoke virtual method 'float android.view.InputDevice$MotionRange.getMin()' on a null object reference

我转到另一个项目并收到相同的错误,该错误发生在TextField,按钮和GridList项中.

我认为这可能是SDK中的错误

Flutter: 1.2.1
Dart: 2.2.0

我升级了颤振,现在就收到了.
完整的日志是:

 Shutting down VM E/AndroidRuntime(26099): FATAL EXCEPTION: main
 E/AndroidRuntime(26099): Process: videira.com.videiralideres, PID:
 26099 E/AndroidRuntime(26099): java.lang.NullPointerException: Attempt
 to invoke virtual method 'float
 android.view.InputDevice$MotionRange.getMin()' on a null object
 reference E/AndroidRuntime(26099):     at
 io.flutter.view.FlutterView.addPointerForIndex(FlutterView.java:480)
 E/AndroidRuntime(26099):   at
 io.flutter.view.FlutterView.onTouchEvent(FlutterView.java:542)
 E/AndroidRuntime(26099):   at
 android.view.View.dispatchTouchEvent(View.java:11779)
 E/AndroidRuntime(26099):   at
 android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2971)
 E/AndroidRuntime(26099):   at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
 E/AndroidRuntime(26099):   at
 android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2971)
 E/AndroidRuntime(26099):   at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
 E/AndroidRuntime(26099):   at
 android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2971)
 E/AndroidRuntime(26099):   at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
 E/AndroidRuntime(26099):   at
 com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:477)
 E/AndroidRuntime(26099):   at
 com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1835)
 E/AndroidRuntime(26099):   at
 android.app.Activity.dispatchTouchEvent(Activity.java:3326)
 E/AndroidRuntime(26099):   at
 com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:439)
 E/AndroidRuntime(26099):   at
 android.view.View.dispatchPointerEvent(View.java:12018)
 E/AndroidRuntime(26099):   at
 android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4829)
 E/AndroidRuntime(26099):   at
 android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4643)
 E/AndroidRuntime(26099):   at
 android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4181)
 E/AndroidRuntime(26099):   at

新细节:
我可以看到使用镜子(Vysor或ScrCpy)时会发生错误,当我用手指使用真实手机时,我只能使用该应用程序.

解决方法:

当我们使用应用程序在PC上进行镜像时,这是一个Flutter的错误,只需要更新Flutter,我使用的是1.3.8,就可以正常工作.

上一篇:JAVA 中的Optional (臭名昭著的空指针异常(NullPointerException))


下一篇:在GPS上运行的Android应用程序中的NullPointerException