android-layoutandroid-color

Couldn't resolve resource @color/colorAccent


I got this error. Would somebody know how to fix it. All i had written

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="background_color">#009688</color>
    <color name="white">#FFFFFF</color>
    <color name="black">#000000</color>
    <color name="white_greyish">#EEEEEE</color>
    <color name="button_selectorcolor">#9E9E9E</color>
</resources>

Solution

  • As your colors resource XML is not showing the color you want to use i.e., colorAccent so add this color in your colors.xml file like this:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <color name="background_color">#009688</color>
        <color name="white">#FFFFFF</color>
        <color name="black">#000000</color>
        <color name="white_greyish">#EEEEEE</color>
        <color name="button_selectorcolor">#9E9E9E</color>
        <color name="colorAccent">YOUR_DESIRED_COLOR_CODE</color>
    </resources>