Flutter Android 任务 ':auto_orientation:verifyReleaseResources' 构建失败

Flutter Android build failed for task ':auto_orientation:verifyReleaseResources'

当我 运行 命令 flutter build apk --release 时,我会遇到以下 auto_orientation 问题。

在我的 pubspec.yaml 文件中,我包含了最新版本 auto_orientation: ^1.0.5

顺便说一句。当我 运行 使用 flutter run 的项目时,一切 工作正常

FAILURE: Build failed with an exception.                                

* What went wrong:                                                      
Execution failed for task ':auto_orientation:verifyReleaseResources'.   
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  /Users/johannes/flutter_projects/udare/app/build/auto_orientation/intermediates/res/merged/release/values/values.xml:236: error: resource android:attr/fontVariationSettings not found.
  /Users/johannes/flutter_projects/udare/app/build/auto_orientation/intermediates/res/merged/release/values/values.xml:237: error: resource android:attr/ttcIndex not found.
  error: failed linking references.   

扑博士:

[✓] Flutter (Channel master, v1.12.15-pre.29, on Mac OS X 10.14.6 18G95, locale
    en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Android Studio (version 3.4)
[✓] VS Code (version 1.40.2)
[✓] Connected device (1 available)

• No issues found!

@GreenTigerEye,这可能是因为AndroidX不兼容。您可以尝试直接使用 auto_orientation 包的源代码或尝试提到的几个选项 here 来解决类似问题。