flutter viewport的错误,当我尝试在Android上运行应用程序,甚至在Chrome上。我尝试了以下操作:
- 重装Flutter
- 创建新项目
- 克隆现有项目
- 在网络上运行更新android studio
- 用户使用不同版本的Gradle
- 升级java
flutter pub cache clean
- 删除build文件夹
例外情况:
/flutter/packages/flutter/lib/src/rendering/viewport.dart:1375:15: Error: Expected an identifier, but got '.'.
Try inserting an identifier before '.'.
.hasthrow FlutterError.fromParts(<DiagnosticsNode>[
^
/flutter/packages/flutter/lib/src/rendering/viewport.dart:1375:16: Error: Expected ';' after this.
.hasthrow FlutterError.fromParts(<DiagnosticsNode>[
^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script '/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1156
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Applications/Development/flutter/bin/flutter'' finished with non-zero exit value 1
房扑医生应要求:
[✓] Flutter (Channel stable, 3.0.5, on macOS 13.0 22A5311f darwin-x64, locale en-US)
• Flutter version 3.0.5 at /Applications/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (3 weeks ago), 2022-07-13
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
⣯
Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/alina/Library/Android/sdk
• Platform android-31, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
:hammer: https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
:hammer: https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.69.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.46.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0 22A5311f darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.134
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
[✓] Flutter (Channel stable, 3.0.5, on macOS 13.0 22A5311f darwin-x64, locale en-US)
• Flutter version 3.0.5 at /Applications/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (3 weeks ago), 2022-07-13
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
⣯
Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/alina/Library/Android/sdk
• Platform android-31, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
:hammer: https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
:hammer: https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.69.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.46.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0 22A5311f darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.134
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
1条答案
按热度按时间yzuktlbb1#
如果有人遇到这个问题,那是因为他们修改了viewport的代码
要更正它,请转到错误指示的位置,并检查那里是否没有任何更改,例如,我碰巧添加了一个,而没有意识到这一点。
你能注意到我把逗号放在第二行代码的什么地方吗