Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No resource found that matches the given name (at 'android:color Primary')

<resources>
  <!-- inherit from the material theme -->
 <style name="AppTheme" parent="android:Theme.Material">
   <!-- Main theme colors -->
   <!--   your app branding color for the app bar -->
   <item name="android:colorPrimary">@color/primary</item>
   <!--   darker variant for the status bar and contextual app bars -->
   <item name="android:colorPrimaryDark">@color/primary_dark</item>
   <!--   theme UI controls like checkboxes and text fields -->
   <item name="android:colorAccent">@color/accent</item>
 </style>
</resources>

Please try to resolve the problem.

like image 864
Mukul Lakhwani Avatar asked Nov 12 '14 07:11

Mukul Lakhwani


2 Answers

android:Theme.Material requires API level 21 and so it's cleared that your minSDKVersion is lower than 21.

If you really want to develop app for API 21 then declare android:minSDKVersion=21.

And if in case you want to provide compatibility to lower version then you need to use support library, which is commonly known as AppCompat library.

You can access above attributes using AppCompat:

 <item name=”colorPrimary”>@color/primary</item>
 <item name=”colorPrimaryDark”>@color/primary_dark</item>
like image 155
Paresh Mayani Avatar answered Sep 25 '22 00:09

Paresh Mayani


Actually, you can use this attribute, using the support library:

<style name="AppTheme" parent="@style/Theme.AppCompat.Light">

    <item name="colorPrimary">...</item>
</style>

You can also use the others:

    <item name="colorPrimaryDark">...</item>
    <item name="colorAccent">...</item>
like image 25
android developer Avatar answered Sep 23 '22 00:09

android developer