将颤振从 2.5 升级到 2.8 后出错

Posted

技术标签:

【中文标题】将颤振从 2.5 升级到 2.8 后出错【英文标题】:Error after upgrading flutter from 2.5 to 2.8 【发布时间】:2022-01-14 05:53:03 【问题描述】:

我将 Flutter 从 2.5 升级到 2.8,当我运行应用程序时出现以下错误:

Launching lib\main.dart on android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/inspireui-1.0.9/lib/icons/material.dart:5943:25: Error: Member not found: 'six_ft_apart'.
  'six_ft_apart': Icons.six_ft_apart,
                        ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/inspireui-1.0.9/lib/icons/material.dart:5944:31: Error: Member not found: 'six_ft_apart_sharp'.
  'six_ft_apart_sharp': Icons.six_ft_apart_sharp,
                              ^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/inspireui-1.0.9/lib/icons/material.dart:5945:33: Error: Member not found: 'six_ft_apart_rounded'.
  'six_ft_apart_rounded': Icons.six_ft_apart_rounded,
                                ^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/inspireui-1.0.9/lib/icons/material.dart:5946:34: Error: Member not found: 'six_ft_apart_outlined'.
  'six_ft_apart_outlined': Icons.six_ft_apart_outlined,
                                 ^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-5.1.3/lib/src/gesture_detector/scale.dart:32:11: Error: No named parameter with the name 'delta'.
          delta: delta,
          ^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-5.1.3/lib/src/gesture_detector/scale.dart:339:43: Error: Too few positional arguments: 2 required, 1 given.
          focalPointDelta > computePanSlop(pointerDeviceKind))
                                          ^
/C:/src/flutter/packages/flutter/lib/src/gestures/events.dart:2116:8: Context: Found this candidate, but the arguments don't match.
double computePanSlop(PointerDeviceKind kind, DeviceGestureSettings? settings) 
       ^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-5.1.3/lib/src/gesture_detector/drag.dart:46:66: Error: Too few positional arguments: 2 required, 1 given.
    final double minDistance = minFlingDistance ?? computeHitSlop(kind);
                                                                 ^
/C:/src/flutter/packages/flutter/lib/src/gestures/events.dart:2103:8: Context: Found this candidate, but the arguments don't match.
double computeHitSlop(PointerDeviceKind kind, DeviceGestureSettings? settings) 
       ^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-5.1.3/lib/src/gesture_detector/drag.dart:54:55: Error: Too few positional arguments: 2 required, 1 given.
    return _globalDistanceMoved.abs() > computeHitSlop(pointerDeviceKind);
                                                      ^
/C:/src/flutter/packages/flutter/lib/src/gestures/events.dart:2103:8: Context: Found this candidate, but the arguments don't match.
double computeHitSlop(PointerDeviceKind kind, DeviceGestureSettings? settings) 
       ^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-5.1.3/lib/src/gesture_detector/drag.dart:101:66: Error: Too few positional arguments: 2 required, 1 given.
    final double minDistance = minFlingDistance ?? computeHitSlop(kind);
                                                                 ^
/C:/src/flutter/packages/flutter/lib/src/gestures/events.dart:2103:8: Context: Found this candidate, but the arguments don't match.
double computeHitSlop(PointerDeviceKind kind, DeviceGestureSettings? settings) 
       ^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-5.1.3/lib/src/gesture_detector/drag.dart:109:55: Error: Too few positional arguments: 2 required, 1 given.
    return _globalDistanceMoved.abs() > computeHitSlop(pointerDeviceKind);
                                                      ^
/C:/src/flutter/packages/flutter/lib/src/gestures/events.dart:2103:8: Context: Found this candidate, but the arguments don't match.
double computeHitSlop(PointerDeviceKind kind, DeviceGestureSettings? settings) 
       ^^^^^^^^^^^^^^


FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1070

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\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 1m 10s
Exception: Gradle task assembleDebug failed with exit code 1

【问题讨论】:

首先,使用flutter clean 清理构建文件,然后使用flutter pub get 再次获取发布包。如果之后问题仍然存在,请运行flutter pub cache repair 命令以适应所有缓存的 pub 包的新更改。 Flutter 只需要清理一下。正如@ashok 正确提到的那样。您需要清理以前的构建并清除缓存。然后运行构建命令。它应该编译。如果不让我们知道 我也遇到了这个问题,我决定暂时降级到 2.5.3 @MichaelTran 【参考方案1】:

据我所知,他们已将 six_ft_... 重命名为 six__ft_...,注意双下划线。

在他们修复之前,您可以在包的本地副本中手动更改它。

其他没用的,也删掉就好了。

【讨论】:

【参考方案2】:

当我将我的颤振升级到 2.8 时,它只需要从 android sdk manager tools 下载 cmdline-tools。 如果您仍然没有下载它,请尝试下载它。 然后 将 android-sdk/tools 路径添加到环境中

祝你好运

【讨论】:

【参考方案3】:

运行 flutter clean 并使用 flutter pub get 重建 Flutter 项目应该有助于映射项目缺少的构建文件。这个技巧对我很有效。

【讨论】:

以上是关于将颤振从 2.5 升级到 2.8 后出错的主要内容,如果未能解决你的问题,请参考以下文章

将数据从 FireBase 检索到颤振项目时出错

将 Mongodb 从 3.2 升级到 3.6 时出错

在 Joomla 2.5 中激活 SEO 设置后出错

将 Bundler 升级到 2.1.4 后初始化 Rails 控制台出错

在Android Studio中将Gradle从3.3升级到4.1后出错

将 Android Studio 项目从 0.8.6 升级到 RC4 时出错