在安装eclipse并配置android开发环境时出现错误,导致新建安卓项目时出现如下问题:
[2016-09-02 10:28:34 - t] D:\android\t\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-09-02 10:28:34 - t]
[2016-09-02 10:28:34 - t] D:\android\t\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-09-02 10:28:34 - t]
[2016-09-02 10:28:34 - t] D:\android\t\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2016-09-02 10:28:34 - t]
因为不知道是什么原因,到网上查了一下,发现各种说法:我检查了adt安装更新、sdk的安装,最后发现是支持库的问题。
使用adt开发新建一个Android app,选择支持的SDK版本如果小于11(Android3.0)就会报如上错误。
参考的完整解法是:http://www.360doc.com/content/15/0316/15/9200790_455576135.shtml
简单来说就是新的eclipse默认模版主题UI需要使用比较高版本api,如果需要支持低版本,需要导入appCompact库来支持,解法大概步骤如下:
- File->Import (android-sdk\extras\android\support\v7). Choose "appcompat"
- Project-> properties->Android. In the section library "Add" and choose "appCompat"