I have implemented material design into my app and it runs perfectly fine on < Android 5 but when I try to run on Android 5.0 and above I get the following in my logcat.<
You can not use alfa in primary color. The primary color has to be opaque.
Change:
<item name="colorPrimaryDark">#4DFF9800</item>
<item name="colorPrimary">#4D607D8B</item>
To
<item name="colorPrimaryDark">#FF9800</item>
<item name="colorPrimary">#607D8B</item>
for api 21 in res/values-v21/style.xml
file
Simple solution to the issue is to remove the opaque applied to the primary color in colors.xml
When opaque is applied to primary color the color code look like this "#aca688ff", where it has to be ex: "#F50057" (6 letters alphanumeric code without opaque).
Hope the above solution helps you to fix the issue.
Error java.lang.RuntimeException: A TaskDescription's primary color should be opaque
Answer: go to your app-->value-->color and look at your primary color and count the characters there It must have six hexa characters(like #FDEF25).. It must not have more than six characters.
Here is the video for easiness
@Konrad Krakowiak is right.
You can see the source code of android.app.ActivityManager#TaskDescription.
/**
* Creates the TaskDescription to the specified values.
*
* @param label A label and description of the current state of this task.
* @param icon An icon that represents the current state of this task.
* @param colorPrimary A color to override the theme's primary color. This color must be opaque.
*/
public TaskDescription(String label, Bitmap icon, int colorPrimary) {
if ((colorPrimary != 0) && (Color.alpha(colorPrimary) != 255)) {
throw new RuntimeException("A TaskDescription's primary color should be opaque");
}
mLabel = label;
mIcon = icon;
mColorPrimary = colorPrimary;
}