didi/DoKit · error · IllegalArgumentException
Use setColor method of Paint class to specify line color. Do
Error message
Use setColor method of Paint class to specify line color. Do not provider ColorProvider if you set PaintProvider.
What it means
Thrown by FlexibleDividerDecoration.Builder.checkBuilderParams() when both a PaintProvider and a ColorProvider are set on the divider builder. A PaintProvider supplies the whole Paint (which already carries its color via paint.setColor), so an additional ColorProvider is ambiguous and the builder rejects the conflicting configuration at build() time.
Source
Thrown at Android/dokit/src/main/java/com/didichuxing/doraemonkit/kit/toolpanel/decoration/FlexibleDividerDecoration.java:545
public T visibilityProvider(VisibilityProvider provider) {
mVisibilityProvider = provider;
return (T) this;
}
public T showLastDivider() {
mShowLastDivider = true;
return (T) this;
}
public T positionInsideItem(boolean positionInsideItem) {
mPositionInsideItem = positionInsideItem;
return (T) this;
}
protected void checkBuilderParams() {
if (mPaintProvider != null) {
if (mColorProvider != null) {
throw new IllegalArgumentException(
"Use setColor method of Paint class to specify line color. Do not provider ColorProvider if you set PaintProvider.");
}
if (mSizeProvider != null) {
throw new IllegalArgumentException(
"Use setStrokeWidth method of Paint class to specify line size. Do not provider SizeProvider if you set PaintProvider.");
}
}
}
}
}View on GitHub (pinned to 626827cddb)
Solutions
- Remove the ColorProvider/color() call and set the color directly on the Paint you supply: paint.setColor(color) before builder.paintProvider(...)
- Keep ColorProvider and drop PaintProvider if you only need a color
- If both are needed dynamically, choose per-item inside a single PaintProvider
Example fix
// before
builder.paintProvider(() -> paint)
.color(0xFF00FF00) // throws in checkBuilderParams()
.build();
// after
paint.setColor(0xFF00FF00);
builder.paintProvider(() -> paint)
.build(); Defensive patterns
Strategy: validation
Validate before calling
if (paintProvider != null) {
// ensure no color()/colorProvider() was set: set color on the Paint itself
paint.setColor(lineColor);
}
builder.paintProvider(() -> paint).build(); // no ColorProvider set Prevention
- Pick one styling channel: either PaintProvider (color+size on the Paint) or Color/Size providers, never both
- Audit reused/shared divider builders for providers set by earlier helper calls
When it happens
Trigger: Calling builder.paintProvider(...) followed by builder.colorProvider(...) (or the color(int) convenience) and then build() on a RecyclerView divider used by a DoKit tool panel.
Common situations: Copy-pasted divider setup where a base config sets a color and a later customization adds a custom Paint; upgrading a divider setup that previously used only color to a PaintProvider without removing the old color call
Related errors
- Use setStrokeWidth method of Paint class to specify line siz
- Set circle needn't set radius.
- invalid shadow size
- failed to get size
- failed to get size
AI-assisted analysis of didi/DoKit@626827cddb (2026-08-14).
Data as JSON: /api/errors/69b8667771418332.
Report an issue: GitHub.