Android:Android 9中的ScrollView崩溃

时间:2019-02-14 04:04:45

标签: android android-scrollview android-9.0-pie

我正在ScrollView中使用Fragment。我已经在不同设备上测试了我的应用程序,并且应用程序运行良好。但是在Fabric中,我在某些装有Android version 9.0的设备上遇到了崩溃。

崩溃日志:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.VelocityTracker.clear()' on a null object reference
   at android.widget.ScrollView.onTouchEvent(ScrollView.java:695)
   at android.view.View.dispatchTouchEvent(View.java:12513)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3024)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2705)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)
   at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:453)
   at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1830)
   at android.app.Activity.dispatchTouchEvent(Activity.java:3402)
   at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
   at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:411)
   at android.view.View.dispatchPointerEvent(View.java:12752)
   at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5307)
   at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4962)
   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4465)
   at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4518)
   at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4484)
   at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4624)
   at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4492)
   at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4681)
   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4465)
   at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4518)
   at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4484)
   at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4492)
   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4465)
   at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7301)
   at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7270)
   at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7231)
   at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7404)
   at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:187)
   at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)
   at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:178)
   at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:7375)
   at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:7427)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1004)
   at android.view.Choreographer.doCallbacks(Choreographer.java:816)
   at android.view.Choreographer.doFrame(Choreographer.java:745)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:990)
   at android.os.Handler.handleCallback(Handler.java:873)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:193)
   at android.app.ActivityThread.main(ActivityThread.java:6723)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:495)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:859)

如果是ScrollView中的Android 9的错误还是我的错,我感到困惑。任何帮助将不胜感激。

编辑:

我的XML文件。

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorWhite"
    android:fillViewport="true">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentBottom="true"
            android:gravity="center|bottom"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Space
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />

                <com.facebook.shimmer.ShimmerFrameLayout
                    android:id="@+id/shimmer_view_container"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="6"
                    app:shimmer_base_alpha="1"
                    app:shimmer_duration="300"
                    app:shimmer_fixed_width="100dp"
                    app:shimmer_highlight_alpha="0.5"
                    app:shimmer_repeat_delay="2000">

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/btn_start"
                        style="@style/Widget.MaterialComponents.Button"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/start"
                        android:textColor="@android:color/white"
                        app:backgroundTint="@color/colorAccent" />
                </com.facebook.shimmer.ShimmerFrameLayout>

                <Space
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
            </LinearLayout>

            <TextView
                android:id="@+id/privacy_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAlignment="center"
                android:textColor="@android:color/darker_gray"
                android:textColorLink="@color/colorRed"
                android:textSize="10sp" />
        </LinearLayout>

    </RelativeLayout>
</ScrollView>

以及我崩溃的设备。

  • Redmi Note 4
  • Redmi Note 5 Pro
  • 华硕ZenFone Max Pro(M1)
  • 摩托罗拉XT1686

所有人都拥有android版本9.0,但没有root,这是崩溃报告中显示的结构。

0 个答案:

没有答案