appcompat_v7报错:styles_base.xml:20: error: Error retrieving parent for item

创建项目自动生成了appcompat_v7项目,然而appcompat_v7报错:

[2016-12-31 20:10:56 - V7Test] D:\EclipseWorkspace\test\appcompat_v7\res\values-v21\styles_base.xml:37: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
[2016-12-31 20:10:56 - V7Test] 
[2016-12-31 20:10:56 - V7Test] D:\EclipseWorkspace\test\appcompat_v7\res\values-v21\styles_base.xml:41: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
[2016-12-31 20:10:56 - V7Test] 
[2016-12-31 20:10:56 - V7Test] D:\EclipseWorkspace\test\appcompat_v7\res\values-v21\styles_base.xml:65: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.

...
类似上面的很多错误,其实这个问题很简单,但是网上的很多帖子解决方法都不对,或者凑巧对了,但是解释不对。
解决方法:
右键你导入的android-support-v7-appcompat—>properties—>选择左侧栏Android—>在project bulid target中选择api21以上的—>clean即可。
或者
将AndroidManifest.xml和project.properties.xml文件中的targetSdkVersion和target改为android-21或更高即可。

原因:
创建项目时有“编译用SDK版本”(compile with)的选项,编译版本是19,19没有包含21的一些选项,所以把编译版本改成5.0 就可以了。所以: 只用改 编译版本,不用改 target SDK版本 也可以!!
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值