java.lang.ClassCastException:android.view.AbsSavedState $ 1无法转换为android.widget.ScrollView $ SavedState

时间:2019-04-12 08:45:32

标签: android android-view androidx

我最近开始在生产应用中遇到以下异常情况。

{   “ androidApiLevel”:“ 28”,   “ osBuild”:“ PQ2A.190405.003” }

设备:Pixel 2 XL

有什么想法吗?

java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.ScrollView$SavedState
    at android.widget.ScrollView.onRestoreInstanceState(ScrollView.java:1834)
    at android.view.View.dispatchRestoreInstanceState(View.java:18608)
    at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3821)
    at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
    at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
    at android.view.View.restoreHierarchyState(View.java:18586)
    at androidx.e.a.d.restoreViewState(Fragment.java:494)
    at androidx.e.a.j.a(FragmentManager.java:1486)
    at androidx.e.a.j.f(FragmentManager.java:1784)
    at androidx.e.a.j.a(FragmentManager.java:1852)
    at androidx.e.a.j.e(FragmentManager.java:3269)
    at androidx.e.a.j.q(FragmentManager.java:3229)
    at androidx.e.a.g.f(FragmentController.java:201)
    at androidx.e.a.e.onStart(FragmentActivity.java:620)
    at androidx.appcompat.app.d.onStart(AppCompatActivity.java:178)
    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1391)
    at android.app.Activity.performStart(Activity.java:7165)
    at android.app.ActivityThread.handleStartActivity(ActivityThread.java:2975)
    at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
    at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6718)
    at java.lang.reflect.Method.invoke(Method.java:-2)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

1 个答案:

答案 0 :(得分:0)

在某些情况下,两个元素使用相同的ID名称。

重新检查您分配给滚动视图和其他视图的ID