Eclipse开发时自动创建appcompat_v7项目总是报错

来源:互联网 发布:软件管理方法 编辑:程序博客网 时间:2024/04/26 20:52

使用Eclipse Juno作为Android集成开发环境,然而在创建Android项目的时候,如果Minimum Required SDk(需要的最小SDK)是4.0以下的,那么在创建项目,始终会额外创建一个项目(实际上称为兼容库更恰当些)appcompat_v7,而且始终提示下列错误,真是令人头疼:

F:\MyAndroidPlace\appcompat_v7\res\values-v11\styles_base.xml:115: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.

F:\MyAndroidPlace\appcompat_v7\res\values-v17\styles_base.xml:110: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'.

F:\MyAndroidPlace\appcompat_v7\res\values-v21\styles_base.xml:107: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'.

F:\MyAndroidPlace\appcompat_v7\res\values-v21\styles_base.xml:121: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'.

F:\MyAndroidPlace\appcompat_v7\res\values-v21\styles_base.xml:126: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'.

F:\MyAndroidPlace\appcompat_v7\res\values-v21\styles_base.xml:138: error: Error: No resource found that matches the given name: attr 'android:overlapAnchor'.

F:\MyAndroidPlace\appcompat_v7\res\values-v21\styles_base.xml:143: error: Error: No resource found that matches the given name: attr 'android:overlapAnchor'.

F:\MyAndroidPlace\appcompat_v7\res\values-v21\styles_base.xml:129: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'.

F:\MyAndroidPlace\appcompat_v7\res\values-v21\styles_base.xml:132: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'.

F:\MyAndroidPlace\appcompat_v7\res\values-v21\styles_base.xml:146: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.

F:\MyAndroidPlace\appcompat_v7\res\values-v21\styles_base.xml:150: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.


解决方法一:

之前曾试着只创建Android 4.0的项目,即(Minimum Required SDk和Target SDK都选则SDK),这样创建项目时,不会创建appcompat_v7项目,创建的Android项目也就不会报错了。然而之所以Minimum Required SDk选择Android2.3,Target SDK选择Android4.0就是为了兼容各种主流手机配置的。显然这种方法并不理想。


解决方法二:

      因为看到每次系统报错,错误都集中在res目录下的values-v11,values-17,values-21,很明显这些版本的SDK 并没有更新下载到本地。所以只需要更新下Android SDK Manager->Tools下面的所有Android SDK Build-tools就行了。


0 0
原创粉丝点击