实现’com.android.support.constraint:constraint-layout:1.0.2′
通过androID studio中的更新警告,我将此更新为
实现’com.androID.support.constraint:constraint-layout:1.1.0′
之后,每当我尝试构建或运行项目时,我都会遇到以下问题(请参阅堆栈跟踪)
java.lang.AssertionError: top at androID.support.constraint.solver.Widgets.GuIDeline.getAnchor(GuIDeline.java:159) at androID.support.constraint.solver.Widgets.ConstraintWidget.immediateConnect(ConstraintWidget.java:1579) at androID.support.constraint.ConstraintLayout.setChildrenConstraints(ConstraintLayout.java:1012) at androID.support.constraint.ConstraintLayout.updateHIErarchy(ConstraintLayout.java:793) at androID.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1540) at androID.vIEw.VIEw.measure(VIEw.java:18804) at androID.vIEw.VIEwGroup.measureChilDWithmargins(VIEwGroup.java:5954) at androID.Widget.FrameLayout.onMeasure(FrameLayout.java:194) at androID.vIEw.VIEw.measure(VIEw.java:18804) at androID.vIEw.VIEwGroup.measureChilDWithmargins(VIEwGroup.java:5954) at androID.Widget.linearLayout.measureChildBeforeLayout(linearLayout.java:1465) at androID.Widget.linearLayout.measureVertical(linearLayout.java:748) at androID.Widget.linearLayout.onMeasure(linearLayout.java:630) at androID.vIEw.VIEw.measure(VIEw.java:18804) at androID.vIEw.VIEwGroup.measureChilDWithmargins(VIEwGroup.java:5954) at androID.Widget.FrameLayout.onMeasure(FrameLayout.java:194) at com.androID.internal.policy.PhoneWindow$DecorVIEw.onMeasure(PhoneWindow.java:2643) at androID.vIEw.VIEw.measure(VIEw.java:18804) at androID.vIEw.VIEwRootImpl.performMeasure(VIEwRootImpl.java:2112) at androID.vIEw.VIEwRootImpl.measureHIErarchy(VIEwRootImpl.java:1228) at androID.vIEw.VIEwRootImpl.performTraversals(VIEwRootImpl.java:1464) at androID.vIEw.VIEwRootImpl.doTraversal(VIEwRootImpl.java:1119) at androID.vIEw.VIEwRootImpl$TraversalRunnable.run(VIEwRootImpl.java:6060) at androID.vIEw.Choreographer$CallbackRecord.run(Choreographer.java:858) at androID.vIEw.Choreographer.doCallbacks(Choreographer.java:670) at androID.vIEw.Choreographer.doFrame(Choreographer.java:606) at androID.vIEw.Choreographer$FramedisplayEventReceiver.run(Choreographer.java:844) at androID.os.Handler.handleCallback(Handler.java:746) at androID.os.Handler.dispatchMessage(Handler.java:95) at androID.os.Looper.loop(Looper.java:148) at androID.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Native Method) at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:618)
也遇到了崩溃问题,
E/Crashlyticscore: Failed to execute task.java.util.concurrent.TimeoutException at java.util.concurrent.FutureTask.get(FutureTask.java:177) at com.crashlytics.androID.core.CrashlyticsBackgrounDWorker.submitAnDWait(CrashlyticsBackgrounDWorker.java:41) at com.crashlytics.androID.core.CrashlyticsController.handleUncaughtException(CrashlyticsController.java:320) at com.crashlytics.androID.core.CrashlyticsController.onUncaughtException(CrashlyticsController.java:300) at com.crashlytics.androID.core.CrashlyticsUncaughtExceptionHandler.uncaughtException(CrashlyticsUncaughtExceptionHandler.java:42) at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693) at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
如果我恢复到1.0.2版本工作正常.这是一个被注意到的错误吗?如何解决这个问题?
解决方法 我们遇到了同样的问题,问题是新版本添加了一些额外的断言,因此旧代码可能会停止工作,因为约束布局的工作方式,堆栈跟踪根本不直观.public ConstraintAnchor getAnchor(Type anchorType) { switch(anchorType) { case left: case RIGHT: if (this.mOrIEntation == 1) { return this.mAnchor; } break; case top: case BottOM: if (this.mOrIEntation == 0) { return this.mAnchor; } break; case BASEliNE: case CENTER: case CENTER_X: case CENTER_Y: case NONE: return null; } throw new AssertionError(anchorType.name());}
这是导致异常的方法.检查的是,如果指南是垂直指南,任何为其添加约束的项目都应该横向(开始或结束),反之则为垂直指南.
在我们的例子中,我们使用了布局
app:layout_constrainttop_toBottomOf="@+ID/guIDeline"app:layout_constraintStart_toStartOf="@+ID/guIDeline"
检查您的布局,并确保在指南中添加适当的约束.
总结以上是内存溢出为你收集整理的android – 约束 – 布局lib更新从1.0.2到1.1.0出错(Guideline.getAnchor)全部内容,希望文章能够帮你解决android – 约束 – 布局lib更新从1.0.2到1.1.0出错(Guideline.getAnchor)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)