Android resource linking failed解决办法汇总

744 阅读1分钟

这几天创建新项目时遇到这个报错,报错详情如下 image.png 提示各种资源找不到:
AAPT: error: resource android:attr/fontStyle not found
AAPT: error: resource android:attr/font not found
AAPT: error: resource android:attr/fontWeight not found
AAPT: error: resource android:attr/fontVariationSettings not found
AAPT: error: resource android:attr/ttcIndex not found
AAPT: error: resource android:attr/startX not found
最终找到原因是项目中使用了androidx,但compileSdk设置的是23,需要修改为至少28才可以。 当然这只是我的项目遇到这个问题的原因,该问题出现时要考虑项目编译环境的各种插件版本是否能相互满足。