使用Eclipse开发Android时新建项目出现No resource错误求助
Hey there! I see you're working through Android Application Programming by James Talbot and Justin McLean, and ran into a snag when creating your project. Let's fix that styles.xml error together.
First, let's recap the error you're seeing:
[2018-04-16 23:53:15 - OnYourBike-Chapter3] C:\Users\benjo\workspace\learningandroid\OnYourBike-Chapter3\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'T...
This error almost always boils down to a mismatch between your project's target SDK, installed SDK components, or a typo in your theme reference. Here's how to fix it step by step:
Check if you have the API 14 SDK Platform installed
Open the Android SDK Manager in Eclipse (Window → Android SDK Manager). Look for "Android 4.0 (API 14)" and make sure the "SDK Platform" checkbox is checked and fully installed. Thevalues-v14folder is for devices running API 14+, so you need the corresponding SDK resources to exist on your machine to reference its themes.Verify your project's Target SDK version
Right-click your project → Properties → Android. Under "Project Build Target", select API 14 or a higher version. If you have a lower target set, Eclipse can't locate the v14-specific theme resources your styles.xml is trying to use.Double-check your theme name in styles.xml
The error cuts off at 'T...', but it's likely you're referencing a theme like@android:style/Theme.Holo.Lightor similar. Open thevalues-v14/styles.xmlfile, jump to line 8, and make sure the parent theme name is spelled perfectly (no missing characters, typos, or incorrect prefixes). A valid example would look like:<style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light">Clean and rebuild your project
Sometimes Eclipse's build cache gets corrupted. Go to Project → Clean, select yourOnYourBike-Chapter3project, and let Eclipse rebuild it from scratch. This often clears up weird resource reference glitches.
Give these steps a shot—one of them should get your project up and running so you can get back to diving into Android development!
内容的提问来源于stack exchange,提问作者Benjamin Bajic

