flutter build apkすると`Execution failed for task ':app:processReleaseResources'.`と出る


原因

flutter build apk -t -t lib/main_staging.dart --releaseでapkファイルを作成しようとしていた

解消法

flutter build appbundle -t lib/main_production.dart --releaseでaabファイルを作成する

手元でflutter build apkした際に出たエラー

You are building a fat APK that includes binaries for android-arm,
android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app
bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform
        android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform
        android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:
        https://developer.android.com/studio/build/configure-apk-splits#configur
        e-abi-split

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     /Users/dainaikai/.gradle/caches/transforms-2/files-2.1/9d02fd66e7e6d4a1bc03a8f87e50aa5b/appcompat-1.1.0/res/values-v28/values-v28.xml:5:5-8:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

     /Users/dainaikai/.gradle/caches/transforms-2/files-2.1/9d02fd66e7e6d4a1bc03a8f87e50aa5b/appcompat-1.1.0/res/values-v28/values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

     /Users/dainaikai/.gradle/caches/transforms-2/files-2.1/013bbe37b97b7c0e54550a4ba7498a94/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     /Users/dainaikai/.gradle/caches/transforms-2/files-2.1/013bbe37b97b7c0e54550a4ba7498a94/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.

     /Users/dainaikai/.gradle/caches/transforms-2/files-2.1/9d02fd66e7e6d4a1bc03a8f87e50aa5b/appcompat-1.1.0/res/values/values.xml:2772:5-2795:25: AAPT: error: resource android:attr/textFontWeight not found.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 20s