Android Support Library v7: Error retrieving paren

2019-01-10 22:58发布

问题:

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?

回答1:

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.