添加 "local_auth" 库后 Flutter 应用程序失败 运行

Flutter Application fails running after adding "local_auth" library

我在我的 Flutter 项目中使用 local_auth: 0.4.0+1 库,因为我需要它 指纹验证,问题是当我 运行 出现此警告时:

*********************************************************

WARNING: This version of local_auth will break your Android build if it or its dependencies aren't compatible with AndroidX.
         See  for more information on the problem and how to fix it.
         This warning prints for all Android build failures. The real root cause of the error may be unrelated.    
         *********************************************************

然后发生此故障:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
 Android resource linking failed
  Output:  C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:328: error: resource android:attr/fontVariationSettings not found.
  C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:328: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

  Command: C:\Users\emami\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jare7abbb87897c27c7928ae79da9182a2\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\sdk\platforms\android-27\android.jar\
          --manifest\
          C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          -o\
          C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.example.flutterapp\
          -0\
          apk\
          --output-text-symbols\
          C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\intermediates\symbols\debug\R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
  Output:  C:\Users\emami\.gradle\caches\transforms-1\files-1.1\design-27.1.1.aar18f8390bba553635fd03361d6fcc0d\res\values\values.xml:96:5-202: AAPT: error: resource android:attr/fontVariationSettings not found.

  C:\Users\emami\.gradle\caches\transforms-1\files-1.1\design-27.1.1.aar18f8390bba553635fd03361d6fcc0d\res\values\values.xml:96:5-202: AAPT: error: resource android:attr/ttcIndex not found.

  error: failed linking references.
  Command: C:\Users\emami\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jare7abbb87897c27c7928ae79da9182a2\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\sdk\platforms\android-27\android.jar\
          --manifest\
          C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          -o\
          C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.example.flutterapp\
          -0\
          apk\
          --output-text-symbols\
          C:\Users\emami\AndroidStudioProjects\flutter_app\build\app\intermediates\symbols\debug\R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

* 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 10s
Finished with error: Gradle task assembleDebug failed with exit code 1

我的 Flutter SDK 如下:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
有什么问题,我该如何解决?
我想可能是因为与我的 Flutter SDK 和 local_auth 版本冲突。

问题是因为Flutter SDK和local_auth库的版本不兼容,我改成local_auth: 0.3.0,错误消失了。

MainActivity继承FlutterFragmentActivity并将support-v4包添加到build.gradle,或使用androidx。可以参考the example