Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

appcompat_v7: Error retrieving parent for item: No resource found that matches the given name

I am trying to build the Android project that uses appcompat_v7 library.

For that, I created my project through Eclipse -> New Android Sample Project and added my custom styles.xml and then added the appcompat_v7 library Project -> Properties -> Android -> Add.

But I am getting the following errors in appcompat_v7/res/values/styles_base.xml when I compile my project:

appcompat_v7/res/values/styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.

appcompat_v7/res/values/styles_base.xml:84: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.

appcompat_v7/res/values/styles_base.xml:166: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.

appcompat_v7/res/values/styles_base.xml:243: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.

appcompat_v7/res/values/styles_base.xml:261: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base.DropDownItem'.

appcompat_v7/res/values/styles_base.xml:319: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.

appcompat_v7/res/values/styles_base.xml:323: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.Base'.

appcompat_v7/res/values/styles_base.xml:347: error: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Base'.

appcompat_v7/res/values/styles_base.xml:391: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.

appcompat_v7/res/values/themes_base.xml:189: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Base'.

In my manifest I have declared 14 as my minSdkVersion and 19 as targetSdkVersion:

AndroidManifest.xml:

<uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

What can I do to fix these errors and build my project?

like image 913
Randolph Avatar asked Apr 22 '14 22:04

Randolph


4 Answers

Check Build Target of your project and appcompat_v7 library project. They should be same, if your project has lesser Build Target than you get this error and won't be able to build.

To fix the problem in Eclipse go to Project->Properties->Android (Project Build Target) and select equal to your appcompat library project.

like image 142
RamKr Avatar answered Nov 10 '22 14:11

RamKr


  1. Right Click on the supporting library;
  2. Click on Properties;
  3. On the left side click on "Android";
  4. Select the right "Android 5.0 - API 21" and click OK;
  5. Clean the support library: Project -> Clean;

Repeat the above steps for your project.

like image 29
Jakub Czaplicki Avatar answered Nov 10 '22 14:11

Jakub Czaplicki


When using the the appcompat_v7 library the targetSdkVersion should be the same number as the major Android Support Library version number. E.g. on my SDK installation the version number is 23.0.1 and so my targetSdkVersion should be 23 (Android 6.0)

like image 2
hfmanson Avatar answered Nov 10 '22 13:11

hfmanson


I just ran into a similar issue when upgrading appcompat-v7 from 22.2.0 23.1.0. Updating compileSdkVersion to 23 fixed it.

like image 1
Eric Avatar answered Nov 10 '22 15:11

Eric