Tag Archives: :Android resource linking failed

[Solved] Android Studio Compile error: Android resource linking failed

Problem description

Today when running the app through the emulator in Android studio, the following error occurred.

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.

Warning: Android resource linking failed,error: failed linking references。

Troubleshooting

This is usually caused by the project configuration, open File-> Project Structure, and see the modules option as follows:


In the above figure, you will find that the compile sdk version and the build tools version are not the same, so change the build tools version to 26.
This is shown in the figure below:

Run again successfully.

Sometimes, after modifying the above configuration, you will still encounter the error “Android resource linking failed”, but if you look at the build information carefully, you may also encounter another error, as shown in the following marker.

The error reads:

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.

This involves the Android gradle plugin, the specific can refer to the official website, find the matching version.