Error:In declare-styleable FontFamilyFont, unable to find attribute android:font

今天在Android Stuido重新编译项目,结果发现居然build failed!报的错如下:

Error:In <declare-styleable> FontFamilyFont, unable to find attribute android:font
Error:In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex
Error:In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
Error:Execution failed for task ':ehframelibrary:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

这是什么情况啊!!!
那就问一下万能的大神吧,有说是:compileSdkVersion 和buildToolsVersion 的版本太低了,把这两个的版本改成最新的。关键是,我的这个项目都维护了将近一年了,怎么会突然出现这种情况呢?
我的项目中的compileSdkVersion和buildToolsVersion版本分别是:

compileSdkVersion 25
buildToolsVersion '25.0.2'

在没有什么思路的情况下,就先把compileSdkVersion 和buildToolsVersion提升到27和“27.0.3”吧(根据一篇参考博文进行设置),结果还是不行,还是报下面的错误:

Error:In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings

看来还是没有解决问题。

找到原因

直到后面看到这篇文章,我才明白我的情况是怎么回事。
这篇文章分析的思路,及解决的办法给我很大的参考。
产生上面一系列Error的原因是项目中support-v4有重复。
检查自己依赖的第三方库,都已经指定了support-v4包的版本号:25.1.1。然后检查Android Stuido的External Libraries列表中发现support-v4包居然有28.0.0-alphal1。至此,终于明白是第三方库的依赖引进的。
这里写图片描述

查看库依赖

在Android Stuido中切换到Terminal中输入:

gradle :app:dependencies --configuration compile

如果输入上面的命令报错的话,请参考下面的文章:
Android studio 如何查看 library 间的依赖关系
gradle环境变量配置
这里写图片描述
最终发现是WheelPicker这个三方库依赖了support-v4:latest.release,由此导致了上面Error的产生。

解决办法

剔除三方库中的support-v4包:

compile('cn.qqtheme.framework:WheelPicker:1.4.2') { exclude group: 'com.android.support' }

至此世界终于清静了。。。

感谢Adam289的文章,文章地址:最新安卓9.0(Android P) 引起的Bug解决:Error:In FontFamilyFont, unable to find attribute xxx
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值