1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > android模块编译错误 android studio编译出错:Android resource linking failed

android模块编译错误 android studio编译出错:Android resource linking failed

时间:2024-02-16 14:32:06

相关推荐

android模块编译错误 android studio编译出错:Android resource linking failed

问题描述

今天在Android studio通过模拟器运行app的时候,出现了以下错误:

Android resource linking failed

AAPT: D:\developer\androidproject\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.

D:\developer\androidproject\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.

D:\developer\androidproject\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2781: error: resource android:attr/fontVariationSettings not found.

D:\developer\androidproject\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2782: error: resource android:attr/ttcIndex not found.

D:\developer\androidproject\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3207: error: resource android:attr/textFontWeight not found.

error: failed linking references.

提示Android resource linking failed,error: failed linking references。

问题排查

这种情况一般是项目配置导致的,打开 File–> Project Structure,看到modules选项内容如下:

在上图中会发现compile sdk version 和build tools version版本不一致,将build tools version版本也改为26.

如下图所示:

再次运行成功。

有时候修改了上述配置后,还会遇到“Android resource linking failed”的错误,但是,仔细看构建信息,可能还会遇到另外一种错误,如下图标记所示:

错误内容是:

The specified Android SDK Build Tools version (26.0.0) is ignored, as it is below the minimum supported version (29.0.2) for Android Gradle Plugin 4.0.1.

这个就涉及到Android gradle插件了,具体的可参考官网,找到相匹配的版本。

网址是:

https://developer./studio/releases/gradle-plugin?hl=zh_cn

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。