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

时间:2019-12-03 18:39:50

标签: flutter flutter-dependencies

当我运行命令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!

1 个答案:

答案 0 :(得分:1)

@GreenTigerEye,这可能是由于AndroidX不兼容造成的。您可以直接使用auto_orientation软件包的源代码,也可以尝试使用here中提到的一些选项来解决类似问题。