The reason and solution of No resource found that matches the given name xml problem when Eclipse develops Android

The reason and solution of the No resource found that matches the given name 'Theme.AppCompat.Light'.styles.xml problem occurs when Eclipse develops Android

styles.xmlThe file < style name=“AppBaseTheme” parent=“Theme.AppCompat.Light”>
prompts the following error:

Description Resource Path Location Type
error: Error retrieving parent for item: No resource found that matches the given name ‘Theme.AppCompat.Light’. styles.xml /Show/res/values line 7 Android AAPT Problem

reason

wrong version

Solution one (temporary solution)

Check the error point under res/values/styles.xml.

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">

change this to

<style name="AppBaseTheme" parent="android:Theme.Light">

Path: res/values-11/styles.xml

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">

change this to

<style name="AppBaseTheme" parent="android:Theme.Holo.Light">

Path: res/values-14/styles.xml

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">

replace this with

<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar"> 

to run normally.


Solution two

The above error is because the imported project has not been added to the android.support:appcompat-v7 compatibility package, because AppCompat belongs to appcompat-v7, the solution is as follows:

 1. Import the android.support:appcompat-v7 compatibility package, which is in your XXX\sdk\extras\android\support\v7\appcompat path, File—>Import—>Android—>Existing Android Code Into Workspace , click Next.


 Click Browse to select the v7 appcompat path, pay attention to select the Copy projects into workspace option, click Finish, and the import is successful.

 2. Add the android-support-v7-appcompat.jar library to the previously opened project, right-click the original project, Properties—>Android, click Add in Library, select android-support-v7-appcompat, and click OK.


In this way, when you return, you can see that the Library has been added, and click Apply, so that you can see the new addition in the Android Private Libraries in the project file. You android-support-v7-appcompat.jarcan check it first Project——>Clean, and then click compile and run, and there will be no problem.

❕Note : When importing the original project, also select the Copy projects into workspace option! ! !


Ability is limited, please point out any mistakes

Guess you like

Origin blog.csdn.net/Stanford_sun/article/details/124788261