material-components/material-components-android · error · UnsupportedOperationException
Changing divider modes has no effect. ChipGroup do not use…
Error message
Changing divider modes has no effect. ChipGroup do not use divider drawables as spacing.
What it means
ChipGroup.setShowDividerHorizontal is deprecated and throws UnsupportedOperationException because ChipGroup never draws dividers; it uses chip spacing for gaps. The message points you to setChipSpacingHorizontal as the supported way to control horizontal gaps.
Solutions
- Delete the setShowDividerHorizontal call; set chipGroup.chipSpacingHorizontal (or app:chipSpacingHorizontal) instead.
- Audit shared divider utility code so it does not touch ChipGroup.
Example fix
// before chipGroup.setShowDividerHorizontal(LinearLayout.SHOW_DIVIDER_MIDDLE) // throws // after chipGroup.chipSpacingHorizontal = resources.getDimensionPixelOffset(R.dimen.chip_spacing_h)
Defensive patterns
Strategy: validation
Validate before calling
// ChipGroup has no divider modes; only spacing is configurable val spacing = resources.getDimensionPixelOffset(R.dimen.chip_spacing_h) chipGroup.chipSpacingHorizontal = spacing
Prevention
- Do not port LinearLayout SHOW_DIVIDER_* constants to ChipGroup.
- Keep divider-mode logic behind a container-type check.
When it happens
Trigger: Calling chipGroup.setShowDividerHorizontal(dividerMode); adapting LinearLayout's setShowDivider* API when switching to ChipGroup.
Common situations: Porting divider-mode logic (SHOW_DIVIDER_MIDDLE etc.) from LinearLayout-based token rows to ChipGroup; shared theming utilities that call divider APIs on any ViewGroup.
Related errors
- Changing divider drawables have no effect. ChipGroup do not…
- Changing flex wrap not allowed. ChipGroup exposes a…
- %1$s must have its Adapter set to a %2$s
- %1$s requires a value for the %2$s attribute to be set in…
- A MaterialSpring style must have a damping value.
AI-assisted analysis of material-components/material-components-android@ac7e18efee (2026-08-14).
Data as JSON: /api/errors/56c19d4a75fb42b7.
Report an issue: GitHub.
Appendix: source
Thrown at lib/java/com/google/android/material/chip/ChipGroup.java:248
@Deprecated
public void setDividerDrawableHorizontal(Drawable divider) {
throw new UnsupportedOperationException(
"Changing divider drawables have no effect. ChipGroup do not use divider drawables as "
+ "spacing.");
}
/** @deprecated Use {@link ChipGroup#setChipSpacingVertical(int)} instead. */
@Deprecated
public void setDividerDrawableVertical(@Nullable Drawable divider) {
throw new UnsupportedOperationException(
"Changing divider drawables have no effect. ChipGroup do not use divider drawables as "
+ "spacing.");
}
/** @deprecated Use {@link ChipGroup#setChipSpacingHorizontal(int)} instead. */
@Deprecated
public void setShowDividerHorizontal(int dividerMode) {
throw new UnsupportedOperationException(
"Changing divider modes has no effect. ChipGroup do not use divider drawables as spacing.");
}
/** @deprecated Use {@link ChipGroup#setChipSpacingVertical(int)} instead. */
@Deprecated
public void setShowDividerVertical(int dividerMode) {
throw new UnsupportedOperationException(
"Changing divider modes has no effect. ChipGroup do not use divider drawables as spacing.");
}
/** @deprecated Use {@link ChipGroup#setSingleLine(int)} instead. */
@Deprecated
public void setFlexWrap(int flexWrap) {
throw new UnsupportedOperationException(
"Changing flex wrap not allowed. ChipGroup exposes a singleLine attribute instead.");
}
/**View on GitHub (pinned to ac7e18efee)