Studio Compile Sdk Version 使用API23: Android6.0创建项目中使用V4包控件问题兼容解决方案

No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
No resource found that matches the given name 'android:Widget.Material.Button.Colored'

很多时候Android Studio跟新到最高版本的Compile Sdk Version API23: Android6.0 和Build Tools Version 23.0.1

时会使用到很多6.0的属性主题,

可是有时候我们会使用V4包下的一些控件Viewpager,Fragment等,可能会出现一些兼容问题,如果你改成低版本的Compile SDK和Build Tools 来解决兼容问题,就会造成报错,即使你把那个V7包主题删掉,它又自动生成。

报错信息:

E:\androidSutio\News\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml

Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.

Error:(24) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\android-sdk-windows\build-tools\21.0.1\aapt.exe'' finished with non-zero exit value 1

如果想干脆在把

compile 'com.android.support:appcompat-v7:23.1.1'这个V7删掉添加V4包到libs建立依赖,又会报V7包下的一些高版本属性主题找不到异常
E:\androidSutio\News\app\build\intermediates\res\merged\debug\values\values.xml
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
E:\androidSutio\News\app\src\main\res\values\styles.xml
Error:(4, 5) No resource found that matches the given name: attr 'colorAccent'.
Error:(4, 5) No resource found that matches the given name: attr 'colorPrimary'.
Error:(4, 5) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\android-sdk-windows\build-tools\21.0.1\aapt.exe'' finished with non-zero exit value 1


其实解决方案很简单就在
compile 'com.android.support:appcompat-v7:23.1.1'
在依赖节点上面填上个v4支持包写法如下:
下面填上这句话就可以了
compile 'com.android.support:support-v4:23.1.1'

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值