[Solved] Android resource linking failed, error: failed linking references.

Problem description

Android studio 4.0.1 in APP/build Gradle declares to use appcompat-v7, and the compilation times the following errors:

Android resource linking failed
Output:  D:\code\demo\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
D:\code\demo\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
D:\code\demo\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1086: error: resource android:attr/fontVariationSettings not found.
D:\code\demo\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1087: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Command: D:\gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\67766513f93fbda68bd5705c60a70b26\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
        D:\Android\SDK\platforms\android-27\android.jar\
        --manifest\
        D:\code\demo\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
        -o\
        D:\code\demo\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
        -R\
        @D:\code\demo\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
        --auto-add-overlay\
        --java\
        D:\code\demo\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
        --custom-package\
        com.demo\
        -0\
        apk\
        --output-text-symbols\
        D:\code\demo\app\build\intermediates\symbols\debug\R.txt\
        --no-version-vectors
Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

Solution:

In the root directory gradle In the properties file, disable Android X:

# android.useAndroidX=true
# android.enableJetifier=true

It can be solved by rebuilding.

Read More: