constraint-layout lib update from 1.0.2 to 1.1.0 got error (Guideline.getAnchor)
We just got the same issue, the problem is that the new version is adding some extra assertions, thus old code might stop working, because of the way the constraint layout works, the stack trace is not intuitive at all.
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());
}
This is the method that causes the exception. What is checking is that if the Guideline is a vertical one, any item that adds a constraint to it should do it horizontal (start or end) and the other way around for vertical guidelines.
In our case, we had a layout using
app:layout_constraintTop_toBottomOf="@+id/guideline"
app:layout_constraintStart_toStartOf="@+id/guideline"
Check your layouts and make sure you add the proper constraint to the guideline.
Just add android:orientation="horizontal" or android:orientation="vertical" to your Guideline