error: Error retrieving parent for item: No resour

2019-02-08 19:42发布

问题:

I am following the documentation here to install the Android SupportV7 Libary into my project. There are two things that I notice: 1)When I am browsing my SDK installation directory and the Support Library folder, there is no folder named "appcompat" 2)When I install the entire V7 folder anyways I get this error:

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

How can I fix this? (Note: this is in the mediarouter folder)

This is what I see when browsing my SDK installation directory: http://tinypic.com/view.php?pic=2egehc9&s=5#.UkZqoRbnZAg

回答1:

If use Eclipse:

  1. You should reinstall your Android Support Library by Android SDK Manager to get the complete android supportV7 library.
  2. The mediarouter library project dependency on the appcompat library project. So,after you have finished Step 1, you can follow Android Support Library v7: Error retrieving parent for item to fix this problem.


回答2:

Right click the imported android v7 support appcompat library project and open the properties. In android option, choose project build target to be 5.0.1. I hope it works. It worked on my side. It happens because support library contains the functionality of android 5.0.1 and it needs android android 5.0.1 for the build also.



回答3:

For me none of the solutions worked.Last I copied the android-support jar file to sdk folder and restarted the eclipse.Also i changed the view renderer to level 19 in mainActivity.xml and the errors are gone. Also check that same jar, android-support-v4 file exists in C:\Users\admin\AppData\Local\Android\android-sdk\extras\android\support\v4 (the location may vary as per your setup). This way it may support for api level 4 and up. Note:The jar file is simply the android support library.Please ensure your project libraries contain this jar.



回答4:

**Easy prosess

If you are using IntelliJ/AndroidStudio After updating new updates we get these type errors. so,for old/existing project it will give error.

It won't show for new project,it will automatically take the updated one.

Create new project

New project will not show any errors

and compare gradle(Module:app) files in both files in both new and existing projects ..

change the existing/old project gradle file according to newproject gradle file

below change worked for me.. according this fix ur

** compile 'com.android.support:appcompat-v7:25.3.0'

To

compile 'com.android.support:appcompat-v7:25.3.1'