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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章