I upgraded my project ( Ionic Framework ) from Android to AndroidX. After that, my project started throwing errors while rebuilding. It is giving "AAPT: error: resource color/colorPrimary (aka io.aide.aide:color/colorPrimary) not found." from file "{Project}\android\app\src\main\res\values\styles.xml".
Here is my styles.xml
file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:background">@null</item>
</style>
<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
<item name="android:background">@drawable/splash</item>
</style>
</resources>
The folder of styles.xml is as below
In the below post, they suggested to create a color file. Error:(387, 5) error: resource color/colorPrimary (aka com.example.kubix.r3vir3dv3:color/colorPrimary) not found
I am beginner and I do not know what should be in the color file.
Can any one give me any suggestions to overcome this problem?
In your project, you need to create color.xml file
Right click on values > New > Values Resource File > Enter File Name "color.xml"
Path:
res/values/color.xml
This is how your color.xml will look like:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">@color/blue_1</color>
<color name="colorPrimaryDark">@color/blue_1</color>
<color name="colorAccent">@color/blue_5</color>
<color name="blue_1">#00101f</color>
<color name="blue_5">#0078ff</color>
</resources>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With