Home > Software design >  How to fix: "error: resource color not found" in android studio
How to fix: "error: resource color not found" in android studio

Time:04-18

I am getting the following errors in android studios:

/Users/amaan/AndroidStudioProjects/UTATrivia2/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values-night-v8/values-night-v8.xml:37: error: resource color/purple_700 (aka com.example.utatrivia:color/purple_700) not found.
/Users/amaan/AndroidStudioProjects/UTATrivia2/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values-night-v8/values-night-v8.xml:38: error: resource color/black (aka com.example.utatrivia:color/black) not found.

This is my themes.xml file:

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="titleTextColor">@android:color/white</item>
    </style>

</resources>

And this is my colors.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#673AB7</color>
    <color name="colorPrimaryDark">#673AB7</color>
    <color name="colorAccent">#03DAC5</color>

    <color name="colorPurple">#673AB7</color>
    <color name="colorBlue">#3F51B5</color>

    <color name="orange">#FF9800</color>

    <color name="darkOrange">#FF5722</color>
    <color name="shadow_color">#3C3C3C</color>
    <color name="color_white">#FFFFFF</color>

    <color name="light_grey">#E8E8E8</color>
</resources>

I would really appreciate any help.

CodePudding user response:

add these below color codes in your colors.xml

<color name="purple_700">#FF3700B3</color>
<color name="black">#FF000000</color>

you can add your custom color in your hashcode #FF3700B3 but do not change the name of the colors. If the problem is not solved, let me know!

  • Related