java.lang.NoSuchFieldError: android.support.v7.appcompat.R$styleable.Theme_w的解决办法

这几天在搞Fragment和ViewPager的整合,实现底部导航栏的效果,用到了AppCompatActivity,AppCompatActivity是在support library 22之后才有的。我的一开始是19的版本,后面去网上下了个22的support library导进去之后就可以编译通过了,但是运行却报了java.lang.NoSuchFieldError: android.support.v7.appcompat.R$styleable.Theme_w。想了很久。

我猜原因是:因为我建的Android项目最少支持是3.0的,所以会有一个appcompat_v7的项目关联到一起了,而在关联的项目里面的android.support.v7.appcompat包下的R.java文件是找不到styleable.Theme_w的,所以报了以上错误。后来我就把Android sdk manager里面的support library 更新为22.但是更新为22之后又遇到了新建项目时报了No resource found that matches the given name xxxx之类的错误。去网上搜了下,是因为Android sdk build-tools和sdk platform的版本太低了导致的。最后我把它们的版本到升级到22就可以解决了。

所以综上所述。报这个错误很有可能是你的sdk 版本太低了,升级之后就可以解决这个问题了。


No resource found that matches the given name

No resource found that matches the given name

No resource found that matches the given name

No resource found that matches the given name

No resource found that matches the given name

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值