首页 > 解决方案 > 库升级到 1.1.3 后 ConstraintLayout 崩溃

问题描述

我将 ConstraintLayout 库从 1.1.2 升级到 1.1.3,并且在应用程序启动时不断得到这个:

--------- 崩溃开始 10-26 17:21:44.811 22224 22224 E AndroidRuntime: FATAL EXCEPTION: main 10-26 17:21:44.811 22224 22224 E AndroidRuntime: Process: com.motiv.providerRepository。 alpha, PID: 22224 10-26 17:21:44.811 22224 22224 E AndroidRuntime: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams 不能转换为 android.support.constraint.ConstraintLayout$LayoutParams 10-26 17:21 :44.811 22224 22224 E AndroidRuntime: 在 android.support.constraint.ConstraintLayout.getTargetWidget(ConstraintLayout.java:1144) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.constraint.ConstraintLayout.setChildrenConstraints(ConstraintLayout. java:994) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.constraint.ConstraintLayout.updateHierarchy(ConstraintLayout.java:803) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1561) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.View.measure(View.java:23279 ) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.measureHorizo​​ntal(LinearLayout.java:1148) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.onMeasure (LinearLayout.java:687) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.View.measure(View.java:23279) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android .view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928) 10-26 17:21:44.811 22224 22224 E AndroidRuntime:在 android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514) 10-26 17:21:44。811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.measureVertical(LinearLayout.java:806) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.onMeasure(LinearLayout.java:685) 10 -26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.View.measure(View.java:23279) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.constraint.ConstraintLayout.internalMeasureChildren (ConstraintLayout.java:1227) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1572) 10-26 17:21:44.811 22224 22224 E AndroidRuntime:在 android.view.View.measure(View.java:23279) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.constraint.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:1227) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1572) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android. view.View.measure(View.java:23279) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.measureVertical(LinearLayout.java:806) 10-26 17 :21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.onMeasure(LinearLayout.java:685) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.View.measure(View.java:23279) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1502) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android. widget.FrameLayout.onMeasure(FrameLayout.java:185) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:556) 10-26 17:21 :44.811 22224 22224 E AndroidRuntime: 在 android.view.View.measure(View.java:23279) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout。measureVertical(LinearLayout.java:806) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.onMeasure(LinearLayout.java:685) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在android.view.View.measure(View.java:23279) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1638) 10-26 17 :21:44.811 22224 22224 E AndroidRuntime: 在 android.view.View.measure(View.java:23279) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.ViewGroup.measureChildWithMargins(ViewGroup.java: 6928) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout。测量垂直(线性布局.java:806) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.onMeasure(LinearLayout.java:685) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.View。测量(View.java:23279)10-26 17:21:44.811 22224 22224 E AndroidRuntime:在 android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1638)10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.View.measure(View.java:23279) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.constraint.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:1227) 10- 26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1572) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.View.measure(查看.java:23279) 10-26 17:21:44。811 22224 22224 E AndroidRuntime: 在 android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.FrameLayout.onMeasure(FrameLayout.java:185) 10 -26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.View.measure(View.java:23279) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.ViewGroup.measureChildWithMargins(ViewGroup .java:6928) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget .LinearLayout.measureVertical(LinearLayout.java:806) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.widget.LinearLayout.onMeasure(LinearLayout.java:685) 10-26 17:21:44。811 22224 22224 E AndroidRuntime: 在 android.view.View.measure(View.java:23279) 10-26 17:21:44.811 22224 22224 E AndroidRuntime: 在 android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928) 10 -26 17:21:44.812 22224 22224 E AndroidRuntime: 在 android.widget.FrameLayout.onMeasure(FrameLayout.java:185) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 com.android.internal.policy.DecorView .onMeasure(DecorView.java:898) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 android.view.View.measure(View.java:23279) 10-26 17:21:44.812 22224 22224 E AndroidRuntime:在 android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2873) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1910) 10-26 17:21: 44.812 22224 22224 E AndroidRuntime:在 android。view.ViewRootImpl.performTraversals(ViewRootImpl.java:2165) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1779) 10-26 17:21:44.812 22224 22224 E AndroidRuntime:在 android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7810) 10-26 17:21:44.812 22224 22224 E AndroidRuntime:在 android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 android.view.Choreographer.doCallbacks(Choreographer.java:723) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 android.view.Choreographer.doFrame( Choreographer.java:658) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) 10-26 17:21:44.812 22224 22224 E AndroidRuntime:在 android.os.Handler.handleCallback(Handler.java:789) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 android.os.Handler.dispatchMessage(Handler.java:98) 10-26 17:21: 44.812 22224 22224 E AndroidRuntime: 在 android.os.Looper.loop(Looper.java:164) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 android.app.ActivityThread.main(ActivityThread.java:6938) 10 -26 17:21:44.812 22224 22224 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: at com.android.internal.os.Zygote$ MethodAndArgsCaller.run(Zygote.java:327) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)Handler.dispatchMessage(Handler.java:98) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 android.os.Looper.loop(Looper.java:164) 10-26 17:21:44.812 22224 22224 E AndroidRuntime : 在 android.app.ActivityThread.main(ActivityThread.java:6938) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 java.lang.reflect.Method.invoke(Native Method) 10-26 17:21: 44.812 22224 22224 E AndroidRuntime: 在 com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 com.android.internal.os.ZygoteInit .main(ZygoteInit.java:1374)Handler.dispatchMessage(Handler.java:98) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 android.os.Looper.loop(Looper.java:164) 10-26 17:21:44.812 22224 22224 E AndroidRuntime : 在 android.app.ActivityThread.main(ActivityThread.java:6938) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 java.lang.reflect.Method.invoke(Native Method) 10-26 17:21: 44.812 22224 22224 E AndroidRuntime: 在 com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: 在 com.android.internal.os.ZygoteInit .main(ZygoteInit.java:1374)6938) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: at com.android.internal.os .Zygote$MethodAndArgsCaller.run(Zygote.java:327) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)6938) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: at com.android.internal.os .Zygote$MethodAndArgsCaller.run(Zygote.java:327) 10-26 17:21:44.812 22224 22224 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

我在此日志中看不到任何内容,因为它看起来像是系统问题。另外,我不会像崩溃报告中所说的那样手动投射视图持有者。

我试图清理,分析问题,但没有。

在装有 8.0 Android 的三星 S8 上看到的问题。

有任何想法吗?

谢谢

标签: androidandroid-studioandroid-layoutandroid-constraintlayout

解决方案


推荐阅读