升级后在nfc_in_flutter上生成失败

xxhby3vn  于 2023-05-29  发布在  Flutter
关注(0)|答案(1)|浏览(135)

Flutter升级后,我无法构建应用程序。

../../../flutter/.pub-cache/hosted/pub.dartlang.org/nfc_in_flutter-2.0.5/lib/src/api.dart:524:54: Error: The operator '[]' isn't defined for the class 'Object'.
 - 'Object' is from 'dart:core'.
Try correcting the operator to an existing operator, or defining a '[]' operator.
          throw NFCTagSizeTooSmallException(e.details["maxSize"] ?? 0);
                                                     ^

FAILURE: Build failed with an exception.

* Where:
Script '/Users/sissa/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '../../flutter/bin/flutter'' finished with non-zero exit value 1

* 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 41s
Exception: Gradle task assembleDebug failed with exit code 1

这是我的Flutter Doctor输出:

[✓] Flutter (Channel master, 1.27.0-5.0.pre.18, on macOS 11.1 20C69 darwin-x64, locale en-GB)
    • Flutter version 1.27.0-5.0.pre.18 at /Users/sissa/flutter
    • Framework revision 50897c98fc (6 days ago), 2021-02-16 20:13:53 -0800
    • Engine revision 9bcb3bfb0e
    • Dart version 2.13.0 (build 2.13.0-30.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/sissa/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /Users/sissa/Library/Android/sdk
    • Java binary at: /Applications/Android Studio 2.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio 2.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.40.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • SM J610FN (mobile) • bbc7a841 • android-arm    • Android 10 (API 29)
    • Chrome (web)       • chrome   • web-javascript • Google Chrome 88.0.4324.182

• No issues found!

做过但不起作用的动作:

  • Flutter 清洗
  • 使缓存无效/重新启动
iezvtpos

iezvtpos1#

升级到1.27.0-4.0.pre dev通道可以解决这个问题。感谢@Akif的建议。

相关问题