Error in styles_base.xml file - Android application - No resource was found that matches the specified name 'android: Widget.Material.ActionButton'

So, I became a newbie in Android development, and I just created the hello world application. But this gives me errors in the styles_base.xml file of the appcompat_v7 library.

Error: error receiving the parent element: the resource was not found that matches the specified name "Android: Widget.Material.ActionButton. Styles_base.xml / appcompat_v7 / res / values-v21
AAPT Problem

How can I take care of this error? Also why is the appcompat_v7 library used when I don't want this? I mean, how to create a hello world application without using the appcompat_v7 library?

This is the styles_base.xml file that gives the above error.

 <resources> <!-- Like in themes_base.xml, the namespace "*.AppCompat.Base" is used to define base styles for the platform version. The "*.AppCompat" variants are for direct use or use as parent styles by the app. --> <eat-comment/> <style name="Base.Widget.AppCompat.ActionBar.TabView" parent="android:Widget.Material.ActionBar.TabView"> </style> <style name="Base.Widget.AppCompat.Light.ActionBar.TabView" parent="android:Widget.Material.Light.ActionBar.TabView"> </style> <style name="Base.Widget.AppCompat.ActionBar.TabText" parent="android:Widget.Material.ActionBar.TabText"> </style> <style name="Base.Widget.AppCompat.Light.ActionBar.TabText" parent="android:Widget.Material.Light.ActionBar.TabText"> </style> <style name="Base.Widget.AppCompat.Light.ActionBar.TabText.Inverse" parent="android:Widget.Material.Light.ActionBar.TabText"> </style> <style name="Base.TextAppearance.AppCompat.Widget.ActionBar.Menu" parent="android:TextAppearance.Material.Widget.ActionBar.Menu"> </style> <style name="Base.TextAppearance.AppCompat.Widget.ActionBar.Title" parent="android:TextAppearance.Material.Widget.ActionBar.Title"> </style> <style name="Base.TextAppearance.AppCompat.Widget.ActionBar.Subtitle" parent="android:TextAppearance.Material.Widget.ActionBar.Subtitle"> </style> <style name="Base.TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse" parent="android:TextAppearance.Material.Widget.ActionBar.Title.Inverse"> </style> <style name="Base.TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse" parent="android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse"> </style> <style name="Base.TextAppearance.AppCompat.Widget.ActionMode.Title" parent="android:TextAppearance.Material.Widget.ActionMode.Title"> </style> <style name="Base.TextAppearance.AppCompat.Widget.ActionMode.Subtitle" parent="android:TextAppearance.Material.Widget.ActionMode.Subtitle"> </style> <!-- Action Button Styles --> <style name="Base.Widget.AppCompat.ActionButton" parent="android:Widget.Material.ActionButton"> </style> <style name="Base.Widget.AppCompat.ActionButton.CloseMode" parent="android:Widget.Material.ActionButton.CloseMode"> </style> <style name="Base.Widget.AppCompat.ActionButton.Overflow" parent="android:Widget.Material.ActionButton.Overflow"> </style> <!-- Widget.AppCompat.Toolbar style is purposely ommitted. This is because the support Toolbar implementation is used on ALL platforms and relies on the unbundled attrs. The supporting Toolbar styles below only use basic attrs so work fine. --> <style name="Base.Widget.AppCompat.Toolbar.Button.Navigation" parent="android:Widget.Material.Toolbar.Button.Navigation"> </style> <style name="Base.TextAppearance.Widget.AppCompat.Toolbar.Title" parent="android:TextAppearance.Material.Widget.ActionBar.Title"> </style> <style name="Base.TextAppearance.Widget.AppCompat.Toolbar.Subtitle" parent="android:TextAppearance.Material.Widget.ActionBar.Subtitle"> </style> <!-- Spinner Widgets --> <style name="Base.Widget.AppCompat.ListView.DropDown" parent="android:Widget.Material.ListView.DropDown"/> <style name="Base.Widget.AppCompat.DropDownItem.Spinner" parent="android:Widget.Material.DropDownItem.Spinner"/> <style name="Base.Widget.AppCompat.Spinner" parent="android:Widget.Material.Spinner" /> <style name="Base.Widget.AppCompat.Spinner.DropDown.ActionBar" parent="android:Widget.Material.Spinner"> <item name="spinnerMode">dropdown</item> <item name="disableChildrenWhenDisabled">true</item> <item name="popupPromptView">@layout/abc_simple_dropdown_hint</item> </style> <style name="Base.Widget.AppCompat.ListView.Menu" parent="android:Widget.Material.ListView" /> <!-- Popup Menu --> <style name="Base.Widget.AppCompat.ListPopupWindow" parent="android:Widget.Material.ListPopupWindow"> </style> <style name="Base.Widget.AppCompat.PopupMenu" parent="android:Widget.Material.PopupMenu"> </style> <style name="Base.Widget.AppCompat.Light.PopupMenu" parent="android:Widget.Material.Light.PopupMenu"> </style> <style name="Base.Widget.AppCompat.PopupMenu.Overflow"> <item name="android:dropDownHorizontalOffset">-4dip</item> <item name="android:overlapAnchor">true</item> </style> <style name="Base.Widget.AppCompat.Light.PopupMenu.Overflow"> <item name="android:dropDownHorizontalOffset">-4dip</item> <item name="android:overlapAnchor">true</item> </style> <style name="Base.TextAppearance.AppCompat.Widget.PopupMenu.Large" parent="android:TextAppearance.Material.Widget.PopupMenu.Large"> </style> <style name="Base.TextAppearance.AppCompat.Widget.PopupMenu.Small" parent="android:TextAppearance.Material.Widget.PopupMenu.Small"> </style> <style name="Base.TextAppearance.AppCompat.Light.Widget.PopupMenu.Large" parent="android:TextAppearance.Material.Widget.PopupMenu.Large"> </style> <style name="Base.TextAppearance.AppCompat.Light.Widget.PopupMenu.Small" parent="android:TextAppearance.Material.Widget.PopupMenu.Small"> </style> <!-- Search View result styles --> <style name="Base.TextAppearance.AppCompat.SearchResult.Title" parent="@android:TextAppearance.Material.SearchResult.Title"> </style> <style name="Base.TextAppearance.AppCompat.SearchResult.Subtitle" parent="@android:TextAppearance.Material.SearchResult.Subtitle"> </style> <style name="Base.Widget.AppCompat.AutoCompleteTextView" parent="android:Widget.Material.AutoCompleteTextView" /> <style name="Base.Widget.AppCompat.Light.AutoCompleteTextView" parent="android:Widget.Material.AutoCompleteTextView" /> <!-- Progress Bar --> <style name="Base.Widget.AppCompat.ProgressBar.Horizontal" parent="android:Widget.Material.ProgressBar.Horizontal"> </style> <style name="Base.Widget.AppCompat.ProgressBar" parent="android:Widget.Material.ProgressBar"> </style> <!-- TODO. Needs updating for Material --> <style name="Base.Widget.AppCompat.ActivityChooserView" parent=""> <item name="android:gravity">center</item> <item name="android:background">@drawable/abc_ab_share_pack_holo_dark</item> <item name="android:divider">?attr/dividerVertical</item> <item name="android:showDividers">middle</item> <item name="android:dividerPadding">6dip</item> </style> 


This is the code I'm using:

 public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } 
+51
android appcompat
Oct 23 '14 at 14:26
source share
13 answers

Go to your Android SDK installation directory, and then optionally> android> support> v7> appcompat.

in my case: D: \ Software \ adt-bundle-windows-x86-20140702 \ sdk \ extras \ android \ support \ v7 \ appcompat

after you are in the appcompat folder, check the project.properties file and then change the default value from 19 to 21 as: target = android-21. save the file and then update your project. Then clean the project: On the Project tab, select Clear, then select the project and clear ... This will fix the error. use coding ...

+112
Dec 02 '14 at 7:08
source share

I just solved these exact errors. The key point is that your project.properties file in your appcompat library project must use any of the highest version of the API for which your particular appcompat project was written (in your case, it looks like v21). The easiest way I've found is to find the highest folder "values-v **" inside the res folder (for example, values-v21 ).

To clarify in addition to the instructions in the Support Library Setup , your appcompat/project.properties file should have in it: target=android-21 (mine came from 19 instead).

Also make sure that you have the SDK platform installed for this version (for example, the Android 5.0 SDK platform is installed for v21).

See also appcompat-v7: 21.0.0 ': a resource was not found that matches the specified name: attr' android: actionModeShareDrawable '

Alternatively, if you do not want to use appcompat at all, I think that all you need to do is right-click on your project> Properties> Android> Library> Remove link to appcompat. Errors will still be displayed for the appomppat project, but should not affect your project after that.

+42
Oct 31 '14 at 2:36 on
source share

Prerequirements

Make sure you download the latest add-ons as well as the Android 5.0 SDK via the SDK-Manager. enter image description here

+8
Nov 26 '14 at 8:28
source share

This happened to me after I “upgraded” to the 5.0 SDK and wanted to create a new library-enabled application.

In both projects ( project.properties file) in the one you want to use the support library and the support library itself, it needs to set the same target

eg. for my business he worked

  • In the project android-support-v7-appcompat Change project.properties to target=android-21
  • Clear android-support-v7-appcompat in my project (where I want to support the library)
  • In my project, change project.properties to target=android-21 and android.library.reference.1=../android-support-v7-appcompat (or add a support library in the project properties)
  • Clear project
+6
Nov 17 '14 at 11:58
source share

The compiled version of Sdk is set to 21 . change it to 20 or less . Its present in build.gradle in android studio. Then clean the project and rebuild it.

+4
Oct 23 '14 at 2:30 p.m.
source share

My project build The goal of android-support-v7-appcompat was that API 19 just changed it to API 20, which it worked for me.

Right-click on the android-support-v7-appcompat library project Go to properties Click on Android Change project build Target from Android 4.xx to Android 5.0

It helped me, hopefully, and others.

+4
Nov 29 '14 at 9:30
source share

I followed all the instructions, including instructions from Android. Finally, for me, this changed the Project Build Target change from API level to API level 21 in my project.

I am using API 22 (Android 5.1.1), which is newer than when these other answers were written. Thus, you cannot set target = 21 in the support library, as you could 6 months ago.

+2
Jun 19 '15 at 2:40
source share

I am writing an application for API level 21, I tried everything above, but did not work. Finally, I removed Values-v23 from appcompat_v7.This worked.

+2
Nov 03 '15 at 17:56
source share

After changing the target according to the version (as Ben explained), if it still shows errors, just run “Clear” in the project to clear the resource errors.

0
Nov 06 '14 at 18:00
source share

Well, it took me 2 days to figure out the problem. In short, by default, you should just keep the maximum version at the highest level you downloaded, says level 23 (Android M) for my case.

otherwise, you will get these errors. You need to go to the project properties of both your project and appcompat in order to change the target version.

sigh.

0
Nov 30 '15 at 6:11
source share

For my Android Studio workout. I found that this happens when I manually change the version of the Compile SDK from API23 (Android 6) manually to API17 (Android 4.2) in setting up the project structure and trying to change the code in the layout files.

I missed, I realized that I need to change it manually, even in the new project I already selected "Minimum SdK" as 4.2.

Decide just by changing it back to API23 and it can still work on Android 4.2. ^^

0
Dec 29 '15 at 0:19
source share
 Download the latest "sdk platform" and "sdk build tools" of same version like 23.* for both from "sdk Managar". 

(for reference, see the posted image from the back track above). Then right-click on your project -> Properties -> Android -> in the "project build properties" select "API level" 23 or the last that you updated. Then clean the project once.

 Note: But all three should be in same version. 
0
Jan 08 '16 at 13:54 on
source share

please open the installed android sdk directory then

in my way:

E: \ Android \ SDK \ Extras \ Android \ support \ v7 \ AppCompat

then you can see the project.properties file

open it and change the target "target = android-19" to "target = android-23"

it worked for me.

thank you: https://stackoverflow.com/a/464829/

0
May 05 '16 at 5:27
source share



All Articles