No resource found that matches the given name '@style/Theme.AppCompat.Light'
2015-12-08 14:11
615 查看
参考:http://www.apkbus.com/android-246037-1-1.html?_dsign=361a7403
Error:Execution failed for task ‘:app:processDebugResources’.> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘d:\Android\sdk\build-tools\23.0.1\aapt.exe” finished with non-zero exit value 1
项目values目录styles.xml文件里面style为
AndroidManifest.xml文件里面
项目支持的最小SDK小于API 14(即Android4.0),具体表现为
AndroidManifest.xml文件里面, minSdkVersion <14,比如
项目没有导入android-support-v7-appcompat兼容包。
既然没有找到 Theme.AppCompat.Light 主题,那么我就不使用此主题。
此时将项目values,values-v11,values-v14目录下的styles.xml文件里面的style都改为
第二种:
如果没有找到 Theme.AppCompat.Light 主题,而我们又想要使用最新的主题效果呢?
1、 将AndroidManifest.xml文件里面, minSdkVersion改成14,比如
2、此时再将项目values,values-v11,values-v14目录下的styles.xml文件里面style都改为
第三种:
最好的方法就是导入android-support-v7-appcompat库。下***体介绍:
1 、通过Android SDK Manager下载最新的Android Support Library。
2、在module的build.gradle配置中,增添以下语句:
compileSdkVersion 版本比support 版本低时,在上面语句处提示
This support library should not use a different version (23) than the compileSdkVersion (22) less… (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)
compileSdkVersion 版本比support 版本高时,在上面语句处提示
A newer version of com.android.support:appcompat-v7 than 22 is available: 23.0.1 less… (Ctrl+F1)
This detector looks for usages of libraries where the version you are using is not the current stable release. Using older versions is fine, and there are cases where you deliberately want to stick with an older version. However, you may simply not be aware that a more recent version is available, and that is what this lint check helps find.
错误提示:
No resource found that matches the given name ‘@style/Theme.AppCompat.Light’Error:Execution failed for task ‘:app:processDebugResources’.> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘d:\Android\sdk\build-tools\23.0.1\aapt.exe” finished with non-zero exit value 1
示例分析
项目使用的是Theme.AppCompat主题,具体表现为项目values目录styles.xml文件里面style为
[code]<resources> <style name="AppTheme" parent="Theme.AppCompat.Light"></style> </resources>
AndroidManifest.xml文件里面
[code]android:theme="@style/AppTheme"
项目支持的最小SDK小于API 14(即Android4.0),具体表现为
AndroidManifest.xml文件里面, minSdkVersion <14,比如
[code]<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="23" />
项目没有导入android-support-v7-appcompat兼容包。
解决方案
第一种:既然没有找到 Theme.AppCompat.Light 主题,那么我就不使用此主题。
此时将项目values,values-v11,values-v14目录下的styles.xml文件里面的style都改为
[code]<resources> <style name="AppTheme" parent="android:Theme.Light"></style> </resources>
第二种:
如果没有找到 Theme.AppCompat.Light 主题,而我们又想要使用最新的主题效果呢?
1、 将AndroidManifest.xml文件里面, minSdkVersion改成14,比如
[code]<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
2、此时再将项目values,values-v11,values-v14目录下的styles.xml文件里面style都改为
[code]<resources> <style name="AppTheme" parent="android:Theme.Holo.Light"></style> </resources>
第三种:
最好的方法就是导入android-support-v7-appcompat库。下***体介绍:
1 、通过Android SDK Manager下载最新的Android Support Library。
2、在module的build.gradle配置中,增添以下语句:
[code]dependencies { compile 'com.android.support:appcompat-v7:23.0.1 }
compileSdkVersion 版本比support 版本低时,在上面语句处提示
This support library should not use a different version (23) than the compileSdkVersion (22) less… (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)
compileSdkVersion 版本比support 版本高时,在上面语句处提示
A newer version of com.android.support:appcompat-v7 than 22 is available: 23.0.1 less… (Ctrl+F1)
This detector looks for usages of libraries where the version you are using is not the current stable release. Using older versions is fine, and there are cases where you deliberately want to stick with an older version. However, you may simply not be aware that a more recent version is available, and that is what this lint check helps find.
相关文章推荐
- 《Android开发艺术探索》读书笔记 (1) 第1章 Activity的生命周期和启动模式
- 如何单独编译Android源代码中的模块
- iOS重绘机制与图片拉伸
- iOS 升级Xcode7发现的一些问题和解决方案
- Android-自定义控件1-2015-12-22
- iOS 简单的实现手机号正误的判断(Warning: Attempt to present... whose view is not in the window hierarchy!
- iOS9.0 Spotlight的使用方法及总结的一些坑点
- Android基础之CountDownTimer 倒计时类
- iOS支付宝支付步骤
- swift编码出现Call can throw, but it is not marked with 'try' and the error is not handled错误的解决
- IOS 归档和解档
- Android Telephony中缩写含义
- 使用Android Accessibility实现免Root自动批量安装功能
- 微信模板消息推送
- Objective-C研究之Block的使用
- Android开发中一些命名规范
- Android中Bitmap,byte[],Drawable相互转化
- Android Support兼容包详解
- android r cannot be resolved to a variable 错误以及 所有的文件没有报错但是项目报错
- Android studio 如何引用已有工程(project)(module)