android / codelab-constraint-layout

Constraint Layout Codelab
https://codelabs.developers.google.com/codelabs/constraint-layout/
Apache License 2.0
469 stars 243 forks source link

Constraint-layout lib update from 1.0.2 to 1.1.0 got error (Guideline.getAnchor) #53

Open SUBINPTPM opened 6 years ago

SUBINPTPM commented 6 years ago

I currently using constraint-layout by the following lib

implementation 'com.android.support.constraint:constraint-layout:1.0.2'

By update warning in the android studio, I Update this to

implementation 'com.android.support.constraint:constraint-layout:1.1.0'

Then I got the following issue (See stack trace)

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)

Also got the issue as, 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$6.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)

If I revert this back to 1.0.2 version work fine. Is this a noticed bug or not?. How to fix this? I raise this question in StackOverflow

wajahatkarim3 commented 5 years ago

The problem is that we cannot constraint other views vertically to a vertical guideline. For example, we cannot set any View's top and bottom to the vertical guidelines' top and bottom. You need to check your layout and see if there's any View which is being constrained on top/bottom of any vertical guideline and change it to the right/left constraint. I published a detailed article on how to fix this issue on Medium at https://android.jlelse.eu/fixing-constraintlayout-guideline-assertionerror-exception-in-android-5dce450b76fb