有一个遗留的项目,大概半年没维护了,今天要修改个地方,发现编译不过了:
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex
这种In <declare-styleable> FontFamilyFont
之类的问题,google上主要说是compileSdkVersion和buildToolsVersion版本太低的问题,试了无效。然后stackoverflow一个帖子提到是support-v4
更新了之后才有的问题。
于是在运行命令gradle -q dependencies
查看依赖:
image.png
果然,crosswalk依赖了v4包,而且是很低的版本,但是现在v4包已经更新28。所以我们要强制指定代码里面的v4包到一个比较低的版本,比如23。
在build.gradle中加入以下:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:23.1.0'
}
}
此时再运行gradle -q dependencies
:
image.png
可见v4的包已经固定在我们指定的版本了。
然后编译,通过~