【问题标题】:Flutter Errors when recently upgraded最近升级时出现颤振错误
【发布时间】:2020-06-20 08:09:34
【问题描述】:

我遇到了一些奇怪的颤振错误,所以我用谷歌搜索它们并被告知升级颤振似乎没有帮助。我没有碰过这些文件中的任何一个,这是一个错误吗?前一段时间它工作得很好。 我尝试过flutter clean、flutter upgrade、flutter doctor和flutter pub cache repair 这里是扑医生:


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.6)
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.42.1)
[√] Connected device (1 available)

! Doctor found issues in 1 category.
Compiler message:
../flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:273:8: Error: The method 'FlushbarRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
  void install(OverlayEntry insertionPoint) {
       ^
../flutter/packages/flutter/lib/src/widgets/routes.dart:40:8: Context: This is the overridden method ('install').
  void install() {
       ^

Compiler message:
../flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:273:8: Error: The method 'FlushbarRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
  void install(OverlayEntry insertionPoint) {
       ^
../flutter/packages/flutter/lib/src/widgets/routes.dart:40:8: Context: This is the overridden method ('install').
  void install() {
../flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:281:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    super.install(insertionPoint);
                 ^
../flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:281:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    super.install(insertionPoint);
                 ^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\-----\Documents\Flutt\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 833

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\-----\Documents\Flutt\flutter\bin\flutter.bat'' 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 11s
Exception: Gradle task assembleDebug failed with exit code 1'''../flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:281:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    super.install(insertionPoint);
                 ^
../flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:281:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    super.install(insertionPoint);
                 ^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\-----\Documents\Flutt\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 833

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\-----\Documents\Flutt\flutter\bin\flutter.bat'' 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 11s
Exception: Gradle task assembleDebug failed with exit code 1

【问题讨论】:

    标签: gradle flutter dart


    【解决方案1】:

    问题似乎是由flushbar_route插件引起的。

    尝试编辑 flushbar-1.9.1/lib/flushbar_route.dart,它位于

    "%YOURFLUTTERPATH%.pub-cache\hosted\pub.dartlang.org\flushbar-1.9.1\lib\flushbar_route.dart"

    Line 273
    void install() {
    
    And line 281
    super.install();
    

    或者第二个修复方法是将下面的行放在您的 pubspec.yaml 文件中

    flushbar:
        git:
          url: git://github.com/valterh4ck3r/flushbar
          ref: master
    

    来源:查看this了解更多信息。

    【讨论】:

      【解决方案2】:

      在我的情况下,对 pubspec.yaml 的建议编辑导致与其中一个依赖项发生版本冲突。 我刚刚在 pubspec.yaml 的依赖项部分中添加了对稳定旧版本flushbar 的引用

          dependencies:
              flushbar: 1.9.1
      

      【讨论】:

        【解决方案3】:

        似乎(在极少数情况下)不稳定的插件或颤振。

        我建议你切换到稳定的颤振频道(如果是开发版或测试版)

        flutter channel stable
        

        并应用颤振升级

        flutter upgrade
        

        即使您正在编写升级,也可以随时获得稳定的最新版本。这解决了我的情况。希望这会有所帮助。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2021-11-26
          • 2020-07-22
          • 2021-03-05
          • 2021-04-24
          • 2018-12-24
          • 2021-06-06
          • 2021-06-09
          • 2023-02-02
          相关资源
          最近更新 更多