[android] No resource found that matches the given name 'Theme.AppCompat.Light'
在整合android过程中导入别人的项目出现下面的错误:
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
通过stackoverflow查到其解决方法,如下:
1.File->Import (android-sdk\extras\android\support\v7). Choose "appcompat"
在"文件"中导入sdk路径extras\android\support\v7中的appcompat文件夹.如下图所示:
Project-> properties->Android. In the section library "Add" and choose "appCompat"
此时问题即可解决,能正确运行.
问什么会出现这个问题呢?这是我整合“随时拍”项目其他人的代码,他的版本比我的低,
新的eclipse默认模版主题UI需要使用比较高版本api,如果需要支持低版本,需要导入appCompact库来支持.希望文章能解决大家的bug.
包括stackoverflow上也有很多人遇到,但很多人通过这个解决,但我就是没办法解决。
后来发现这个是eclipse的bug,如果你引用的库和你的代码不在一个盘符,就有此异常。 我的代码在E盘,appCompact的库在D盘,我从新将其移动到E盘就ok。 fuck,浪费好多时间。 有遇到同样问题的可参考。
二类问题:values-v11,values-v21,values-v17等等下的No resource found
比方说:
appcompat\res\values-v21\styles_base.xml:75: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
appcompat\res\values-v11\themes_base.xml:178: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
appcompat\res\values-v14\themes_base.xml:27: error: Error: No resource found that matches the given name: attr 'android:actionModePasteDrawable'.
对于在values-v11这类针对不同android target加载的values下找不到资源的问题,原因还是一样,找不到这个target下的资源。
解决方法:
很简单,把project.properties里的target=android-8或者可能稍微高点,改到target=android-21或者更高(前提是sdk已经下载了该target的库),然后再clean下项目。这样这类问题也就解决了,当然你在Manifest里不要忘记加上uses-sdk,来允许最低版本。
更多相关文章
- mybatisplus的坑 insert标签insert into select无参数问题的解决
- Android中build target,minSdkVersion,targetSdkVersion,maxSdkVers
- Windows下 BlackBerry & Google Android(安卓)开发平台搭建
- Flutter 环境第一次运行问题 ProcessException: Process "D:\fl
- 使用android:layout_weight解决布局时把按纽压到屏幕外的问题
- Android(安卓)Zxing修改为竖屏扫描,和连续扫描问题
- Android(安卓)新手摸石头过河
- android中The connection to adb is down .. You must restart a
- Android(安卓)获取已经安装的程序