42

I am trying to build the Android Support Library v7 samples.

For that, I created an sampleproject through Eclipse -> New Android Sample Project and added the android-support-v7-* projects as "Android Project From Existing Code" to Eclipse, and made the sample project reference them.

But I am getting the following errors in android-support-v7-mediarouter/res/values/styles.xml:

error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.ActionButton'. (line 18)

error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.ActionButton'. (line 28)

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

  • I think you should change your target version to 18 in the manifest. android:targetSdkVersion="18" – khubaib Sep 23 '13 at 17:35
  • Remember to do a project clean after changing the API level. Api level 14 or 15 or above will do. – khubaib Sep 23 '13 at 17:42
  • 1
    I have target API 18 on all projects (in project.properties), and target SDK 18 in the samepl project. Cleaning all projects helps nothing. –  Sep 23 '13 at 18:19
  • Possible duplicate of [Can't Find Theme.AppCompat.Light for New Android ActionBar Support](http://stackoverflow.com/questions/17870881/cant-find-theme-appcompat-light-for-new-android-actionbar-support) – blahdiblah Oct 14 '13 at 19:57

1 Answers1

87

You must make the android-support-v7-mediarouter project "aware" of the android-support-v7-appcompat project as a referenced library.

  1. Right click android-support-v7-mediarouter project, select Properties
  2. Select Android
  3. In the Library section at the bottom, click Add....
  4. Select android-support-v7-appcompat in the dialog.
  5. Click Apply.
  6. Click OK.
  7. Do a clean build on the android-support-v7-mediarouter project.
UpLate
  • 1,266
  • 12
  • 17
  • 1
    That did it, perfect. Wouldn't have thought it would be that simple. –  Sep 23 '13 at 22:06
  • 2
    I recently had this error. Thanks. I also had to set to API19 – danny117 Nov 08 '13 at 20:38
  • Please specify which "Add" to click. There is Add JARs, Extrenal JARs, varaible...which one? – Sauron Jan 11 '14 at 06:17
  • 4
    (cleaned-up answer to Eatlon) You're on the wrong screen. You're on [Project->Properties->Java Build Path->Libraries(tab)]. Instead, go to [Project->Properties->Android]. There's one "Add" there (although you may have to scroll down to see it). – UpLate Jan 15 '14 at 05:37