Android项目使用support v7时遇到的各种问题
2015-11-02 11:13
441 查看
最近每简历一个工程,总是遇到各种资源找不到的问题,各种烦,于是找来资料整理一下,基本都能搞定了。
一类问题: values……No resource found
比方说:
res\values\styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name ‘Theme.AppCompat.Light.DarkActionBar’.
对于values这个地方产生的no resource found问题,说明是没有v7下的资源。
解决方法:
添加资源库,针对上面的例子,AppCompat这个是v7里的,所以缺少的是v7的资源。从sdk去获取,路径是sdk\extras\android\support\v7\appcompat,把这个library通过eclipse导入(import)。然后之前的项目添加该lib,再clean下。这样上面的问题可以搞定。
Android项目使用support v7时遇到的各种问题
Android项目使用support v7时遇到的各种问题
二类问题: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,来允许最低版本。
一类问题: values……No resource found
比方说:
res\values\styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name ‘Theme.AppCompat.Light.DarkActionBar’.
对于values这个地方产生的no resource found问题,说明是没有v7下的资源。
解决方法:
添加资源库,针对上面的例子,AppCompat这个是v7里的,所以缺少的是v7的资源。从sdk去获取,路径是sdk\extras\android\support\v7\appcompat,把这个library通过eclipse导入(import)。然后之前的项目添加该lib,再clean下。这样上面的问题可以搞定。
Android项目使用support v7时遇到的各种问题
Android项目使用support v7时遇到的各种问题
二类问题: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,来允许最低版本。
相关文章推荐
- 【转】android如何查看cpu的占用率和内存泄漏
- 浅谈Service Manager成为Android进程间通信(IPC)机制Binder守护进程之路
- Android的onCreateOptionsMenu()创建菜单Menu详解
- Android图片异步加载
- android framework
- Update: Android.mk 中的 LOCAL_SRC_FILES, LOCAL_C_INCLUDES
- 学Android---布局(二)RalativeLayout
- Android Studio自定义组合控件
- 编写 android.mk 中 LOCAL_C_INCLUDES 的技巧
- 编写Android.mk中的LOCAL_SRC_FILES的终极技巧
- 详细介绍Toast.makeText(this, "string string string",Toast.LENGTH_LONG).show();
- android中sharedPreferences的用法
- 如何使用Android Studio把自己的Android library分发到jCenter和Maven Central
- Android:entries的使用
- Android开源项目分类汇总
- android地址
- Android开发环境搭建(转载)
- Android之如何解决刚下载的Android studio(包括上面的菜单栏)乱码问题
- android二维码的生成和扫描
- [Android Studio]Failed to install Intel HAXM 问题解决