How to Fix com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed

2019 unicorn enterprise to recruit Python engineer standard > > >

record import Google android case error solution is as follows: the android. Builder. Internal. The aapt. V2. Aapt2Exception: android resource linking failed

is as follows:

Android resource linking failed
Output:  /Users/chmy/git/android/googlesamples/android-MessagingService/Application/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:221: error: resource android:attr/fontStyle not found.
/Users/chmy/git/android/googlesamples/android-MessagingService/Application/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:222: error: resource android:attr/font not found.
/Users/chmy/git/android/googlesamples/android-MessagingService/Application/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:223: error: resource android:attr/fontWeight not found.
/Users/chmy/git/android/googlesamples/android-MessagingService/Application/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:224: error: resource android:attr/fontVariationSettings not found.
/Users/chmy/git/android/googlesamples/android-MessagingService/Application/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:225: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Command: /Users/chmy/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-4818971-osx.jar/cc4633529fe8cee26cd686b6b28203cf/aapt2-3.2.0-4818971-osx/aapt2 link -I\
        /Users/chmy/Library/Android/sdk/platforms/android-24/android.jar\
        --manifest\
        /Users/chmy/git/android/googlesamples/android-MessagingService/Application/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
        -o\
        /Users/chmy/git/android/googlesamples/android-MessagingService/Application/build/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
        -R\
        @/Users/chmy/git/android/googlesamples/android-MessagingService/Application/build/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
        --auto-add-overlay\
        --java\
        /Users/chmy/git/android/googlesamples/android-MessagingService/Application/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
        --custom-package\
        com.example.android.messagingservice\
        -0\
        apk\
        --output-text-symbols\
        /Users/chmy/git/android/googlesamples/android-MessagingService/Application/build/intermediates/symbols/debug/R.txt\
        --no-version-vectors
Daemon:  AAPT2 aapt2-3.2.0-4818971-osx Daemon #0

there is a lot of talk on the web about adding a configuration to gradle.properties, but the addition is not solved.

solution: the compiled version is not configured correctly. Original version number:

android {
    //
    compileSdkVersion 24

    buildToolsVersion '28.0.3'

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 24

    }
...

after modification:

android {
    // 
    compileSdkVersion 28

    buildToolsVersion '28.0.3'

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 28

    }

compiles again, and the problem is resolved. This is the solution I came across, others are not met for the time being.

reproduced in: https://my.oschina.net/who7708/blog/2236811

Read More: