The mColors member can be null, as can be seen in GradientDrawable.setSolidColor() or the plain constructor. In that case, an NPE will be thrown on attempts to derive a new GradientDrawable from the instance using the private constructor GradientDrawable(GradientDrawable). The problem also occurs when inflating a GradientDrawable from XML without defining the start, center and end colors and then calling mutate() on the instance.