好的,我什至不知道该写些什么。几个小时前一切正常。然后我看到Flutter升级可用。所以我尝试升级。那就是一切开始崩溃的时候。无论如何,我使用vpn运行终端命令。我成功了之后,我打开的每个颤振项目都显示此错误。 我尝试了其他项目。
我可以运行并构建apk,但是这里有错误。 以下是运行命令的输出:
Launching lib\main.dart on POCOPHONE F1 in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
D/FlutterActivity(27090): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate(27090): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate(27090): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
D/FlutterActivityAndFragmentDelegate(27090): Attaching FlutterEngine to the Activity that owns this Fragment.
D/FlutterView(27090): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@4b90e47
D/FlutterActivityAndFragmentDelegate(27090): Executing Dart entrypoint: main, and sending initial route: /
Debug service listening on ws://127.0.0.1:51142/_qlZxn05Q8o=/ws
Syncing files to device POCOPHONE F1...
W/.covidtrackerb(27090): Long monitor contention with owner Answers Events Handler1 (27294) at int java.lang.String.indexOf(java.lang.String, java.lang.String, int)(String.java:1742) waiters=0 in io.fabric.sdk.android.services.common.AdvertisingInfo io.fabric.sdk.android.services.common.IdManager.getAdvertisingInfo() for 1.302s
W/.covidtrackerb(27090): Long monitor contention with owner Answers Events Handler1 (27294) at int java.lang.String.indexOf(java.lang.String, java.lang.String, int)(String.java:1742) waiters=1 in io.fabric.sdk.android.services.common.AdvertisingInfo io.fabric.sdk.android.services.common.IdManager.getAdvertisingInfo() for 1.300s
D/NetworkSecurityConfig(27090): No Network Security Config specified, using platform default
E/FirebaseInstanceId(27090): binding to the service failed
E/AccessibilityBridge(27090): VirtualView node must not be the root node.
I/.covidtrackerb(27090): ProcessProfilingInfo new_methods=3224 is saved saved_to_disk=1 resolve_classes_delay=8000
E/AccessibilityBridge(27090): VirtualView node must not be the root node.
I/flutter (27090): ::Data connection is available.
E/AccessibilityBridge(27090): VirtualView node must not be the root node.
I/flutter (27090): Instance of 'Future<Response>'
I/flutter (27090): Instance of 'Future<Response>'
I/flutter (27090): size response :2
I/flutter (27090): [Instance of 'Response', Instance of 'Response']
I/flutter (27090): CovidBdState Instance of 'AllData'
E/AccessibilityBridge(27090): VirtualView node must not be the root node.
这是Dart分析:
error: Undefined name 'Brightness'. (undefined_identifier at [covidtrackerbd] lib\main_screen.dart:45)
error: The method 'Color' isn't defined for the class '_HomePageState'. (undefined_method at [covidtrackerbd] lib\main_screen.dart:53)
error: The method 'Color' isn't defined for the class '_HomePageState'. (undefined_method at [covidtrackerbd] lib\main_screen.dart:58)
error: The method 'Color' isn't defined for the class '_HomePageState'. (undefined_method at [covidtrackerbd] lib\main_screen.dart:74)
error: The method 'Color' isn't defined for the class '_HomePageState'. (undefined_method at [covidtrackerbd] lib\main_screen.dart:104)
error: Undefined name 'FontWeight'. (undefined_identifier at [covidtrackerbd] lib\main_screen.dart:106)
error: The method 'Color' isn't defined for the class '_HomePageState'. (undefined_method at [covidtrackerbd] lib\main_screen.dart:113)
error: Undefined name 'FontWeight'. (undefined_identifier at [covidtrackerbd] lib\main_screen.dart:115)
error: Undefined name 'FontWeight'. (undefined_identifier at [covidtrackerbd] lib\main_screen.dart:128)
error: The method 'Color' isn't defined for the class '_HomePageState'. (undefined_method at [covidtrackerbd] lib\main_screen.dart:136)
error: Undefined name 'FontWeight'. (undefined_identifier at [covidtrackerbd] lib\main_screen.dart:213)
error: Undefined name 'FontWeight'. (undefined_identifier at [covidtrackerbd] lib\main_screen.dart:260)
error: The method 'Color' isn't defined for the class 'todo'. (undefined_method at [covidtrackerbd] lib\main_screen.dart:409)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\main_screen.dart:419)
error: The method 'Color' isn't defined for the class 'HeatMapTile'. (undefined_method at [covidtrackerbd] lib\main_screen.dart:435)
error: The method 'Color' isn't defined for the class 'HeatMapTile'. (undefined_method at [covidtrackerbd] lib\main_screen.dart:455)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\main_screen.dart:537)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\main_screen.dart:547)
error: The method 'Color' isn't defined for the class 'LoadingScreen'. (undefined_method at [covidtrackerbd] lib\screens\loadingScreen.dart:15)
error: Undefined name 'FontWeight'. (undefined_identifier at [covidtrackerbd] lib\screens\loadingScreen.dart:41)
error: Undefined name 'FontWeight'. (undefined_identifier at [covidtrackerbd] lib\screens\loadingScreen.dart:52)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\loadingScreen.dart:65)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\doctors_report.dart:64)
error: Undefined name 'FontWeight'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\doctors_report.dart:68)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\doctors_report.dart:131)
error: Undefined name 'TextDecoration'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\doctors_report.dart:547)
error: Undefined name 'TextDecoration'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\doctors_report.dart:555)
error: Undefined name 'Brightness'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\formSubmissionPage.dart:24)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\formSubmissionPage.dart:81)
error: Undefined name 'FontWeight'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\formSubmissionPage.dart:85)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\formSubmissionPage.dart:95)
error: Undefined name 'TextDecoration'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\formSubmissionPage.dart:439)
error: Undefined name 'TextDecoration'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\formSubmissionPage.dart:447)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\neighbours_report.dart:58)
error: Undefined name 'FontWeight'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\neighbours_report.dart:62)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\neighbours_report.dart:102)
error: Undefined name 'TextDecoration'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\neighbours_report.dart:391)
error: Undefined name 'TextDecoration'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\neighbours_report.dart:398)
error: Undefined name 'Brightness'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\possible_affected.dart:30)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\possible_affected.dart:65)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\possible_affected.dart:85)
error: Undefined name 'Brightness'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\recurringUpdate.dart:15)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\self_reporting_page.dart:74)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\self_reporting_page.dart:94)
error: Undefined name 'Brightness'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\survey_page.dart:19)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\survey_page.dart:43)
error: Undefined name 'FontWeight'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\Report\survey_page.dart:45)
error: The method 'Color' isn't defined for the class '_SurveyPageState'. (undefined_method at [covidtrackerbd] lib\screens\tabs\Report\survey_page.dart:58)
error: The method 'Color' isn't defined for the class '_SurveyPageState'. (undefined_method at [covidtrackerbd] lib\screens\tabs\Report\survey_page.dart:102)
error: Undefined name 'Brightness'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\developerStory.dart:10)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\developerStory.dart:23)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\developerStory.dart:34)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\developerStory.dart:41)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\developerStory.dart:48)
error: Undefined class 'Color'. (undefined_class at [covidtrackerbd] lib\screens\tabs\home\constants.dart:25)
error: The function 'Color' isn't defined. (undefined_function at [covidtrackerbd] lib\screens\tabs\home\constants.dart:25)
error: Undefined class 'Color'. (undefined_class at [covidtrackerbd] lib\screens\tabs\home\constants.dart:26)
error: The function 'Color' isn't defined. (undefined_function at [covidtrackerbd] lib\screens\tabs\home\constants.dart:26)
error: The function 'Color' isn't defined. (undefined_function at [covidtrackerbd] lib\screens\tabs\home\constants.dart:27)
error: Undefined class 'Color'. (undefined_class at [covidtrackerbd] lib\screens\tabs\home\constants.dart:27)
error: Undefined class 'Color'. (undefined_class at [covidtrackerbd] lib\screens\tabs\home\constants.dart:28)
error: The function 'Color' isn't defined. (undefined_function at [covidtrackerbd] lib\screens\tabs\home\constants.dart:28)
error: The function 'Color' isn't defined. (undefined_function at [covidtrackerbd] lib\screens\tabs\home\constants.dart:29)
error: Undefined class 'Color'. (undefined_class at [covidtrackerbd] lib\screens\tabs\home\constants.dart:29)
error: The function 'Color' isn't defined. (undefined_function at [covidtrackerbd] lib\screens\tabs\home\constants.dart:30)
error: Undefined class 'Color'. (undefined_class at [covidtrackerbd] lib\screens\tabs\home\constants.dart:30)
error: Undefined class 'Color'. (undefined_class at [covidtrackerbd] lib\screens\tabs\home\constants.dart:31)
error: The function 'Color' isn't defined. (undefined_function at [covidtrackerbd] lib\screens\tabs\home\constants.dart:31)
error: The function 'Color' isn't defined. (undefined_function at [covidtrackerbd] lib\screens\tabs\home\constants.dart:33)
error: Undefined class 'Color'. (undefined_class at [covidtrackerbd] lib\screens\tabs\home\constants.dart:33)
error: Undefined class 'Color'. (undefined_class at [covidtrackerbd] lib\screens\tabs\home\constants.dart:34)
error: The function 'Color' isn't defined. (undefined_function at [covidtrackerbd] lib\screens\tabs\home\constants.dart:34)
error: Undefined class 'Color'. (undefined_class at [covidtrackerbd] lib\screens\tabs\home\constants.dart:35)
error: The function 'Color' isn't defined. (undefined_function at [covidtrackerbd] lib\screens\tabs\home\constants.dart:35)
error: The function 'Color' isn't defined. (undefined_function at [covidtrackerbd] lib\screens\tabs\home\constants.dart:36)
error: Undefined class 'Color'. (undefined_class at [covidtrackerbd] lib\screens\tabs\home\constants.dart:36)
error: Undefined name 'Brightness'. (undefined_identifier at [covidtrackerbd] lib\screens\tabs\location.dart:34)
error: Undefined name 'TextAlign'. (undefined_identifier at [covidtrackerbd] lib\screens\widgets\snackPage.dart:20)
info: Unused import: 'dart:async'. (unused_import at [covidtrackerbd] lib\main.dart:2)
info: Unused import: 'package:firebase_crashlytics/firebase_crashlytics.dart'. (unused_import at [covidtrackerbd] lib\main.dart:8)
info: Name non-constant identifiers using lowerCamelCase. (non_constant_identifier_names at [covidtrackerbd] lib\main_screen.dart:312)
info: Name types using UpperCamelCase. (camel_case_types at [covidtrackerbd] lib\main_screen.dart:395)
info: This method overrides a method annotated as @mustCallSuper in 'State', but doesn't invoke the overridden method. (must_call_super at [covidtrackerbd] lib\screens\tabs\Report\doctors_report.dart:33)
info: Unused import: 'package:covidtrackerbd/services/authentication.dart'. (unused_import at [covidtrackerbd] lib\screens\tabs\Report\possible_affected.dart:5)
info: Unused import: 'formSubmissionPage.dart'. (unused_import at [covidtrackerbd] lib\screens\tabs\Report\possible_affected.dart:9)
info: Unused import: 'package:covidtrackerbd/services/api.dart'. (unused_import at [covidtrackerbd] lib\screens\tabs\Report\self_reporting_page.dart:3)
info: Unused import: 'package:covidtrackerbd/services/json.dart'. (unused_import at [covidtrackerbd] lib\screens\tabs\Report\self_reporting_page.dart:5)
info: Unused import: 'package:flutter_html/flutter_html.dart'. (unused_import at [covidtrackerbd] lib\screens\tabs\Report\self_reporting_page.dart:8)
info: Unused import: 'package:flutter/cupertino.dart'. (unused_import at [covidtrackerbd] lib\screens\tabs\home\constants.dart:23)
info: This method overrides a method annotated as @mustCallSuper in 'AutomaticKeepAliveClientMixin', but doesn't invoke the overridden method. (must_call_super at [covidtrackerbd] lib\screens\tabs\location.dart:29)
顺便说一句,我的导入很好。 Flutter Doctor的输出:
Microsoft Windows [Version 10.0.18363.720]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\Momshad\Documents\GitHub\COVID-Tracker-BD-master\COVID-Tracker-BD-master\App>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale en-001)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.6)
[√] IntelliJ IDEA Community Edition (version 2019.3)
[√] VS Code (version 1.43.1)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
C:\Users\Momshad\Documents\GitHub\COVID-Tracker-BD-master\COVID-Tracker-BD-master\App>
Flutter Doctor -v的输出:
C:\Users\Momshad\Documents\GitHub\COVID-Tracker-BD-master\COVID-Tracker-BD-master\App>flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale en-001)
• Flutter version 1.12.13+hotfix.8 at C:\src\flutter
• Framework revision 0b8abb4724 (7 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\Momshad\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] IntelliJ IDEA Community Edition (version 2019.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.3
• Flutter plugin version 44.0.3
• Dart plugin version 193.6911.31
[√] VS Code (version 1.43.1)
• VS Code at C:\Users\Momshad\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.8.1
[√] Connected device (1 available)
• POCOPHONE F1 • 9ea76ae • android-arm64 • Android 10 (API 29)
• No issues found!
软件包输出获取:
C:\src\flutter\bin\flutter.bat --no-color packages get
Running "flutter pub get" in App... 1.6s
Process finished with exit code 0
软件包升级的输出:
C:\src\flutter\bin\flutter.bat --no-color packages upgrade
Running "flutter pub upgrade" in App... 13.3s
Process finished with exit code 0
我尝试过的事情:
更新:出现了一些错误:
Launching lib\main.dart on POCOPHONE F1 in debug mode...
Compiler message:
lib/initialize.dart:2:8: Error: Not found: 'dart:html'
import 'dart:html';
^
/C:/src/flutter/.pub-cache/hosted/pub.flutter-io.cn/http-0.12.0+4/lib/src/browser_client.dart:6:8: Error: Not found: 'dart:html'
import 'dart:html';
^
/C:/src/flutter/.pub-cache/hosted/pub.flutter-io.cn/http-0.12.0+4/lib/src/browser_client.dart:34:18: Error: 'HttpRequest' isn't a type.
final _xhrs = <HttpRequest>{};
^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/painting/_network_image_web.dart:64:12: Error: Method not found: 'webOnlyInstantiateImageCodecFromUrl'.
return ui.webOnlyInstantiateImageCodecFromUrl(resolved); // ignore: undefined_function
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.flutter-io.cn/http-0.12.0+4/lib/src/browser_client.dart:58:34: Error: 'Blob' isn't a type.
var blob = xhr.response as Blob ?? Blob([]);
^^^^
/C:/src/flutter/.pub-cache/hosted/pub.flutter-io.cn/http-0.12.0+4/lib/src/browser_client.dart:46:15: Error: The method 'HttpRequest' isn't defined for the class 'BrowserClient'.
- 'BrowserClient' is from 'package:http/src/browser_client.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.flutter-io.cn/http-0.12.0+4/lib/src/browser_client.dart').
Try correcting the name to the name of an existing method, or defining a method named 'HttpRequest'.
var xhr = HttpRequest();
^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.flutter-io.cn/http-0.12.0+4/lib/src/browser_client.dart:58:42: Error: The method 'Blob' isn't defined for the class 'BrowserClient'.
- 'BrowserClient' is from 'package:http/src/browser_client.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.flutter-io.cn/http-0.12.0+4/lib/src/browser_client.dart').
答案 0 :(得分:1)
删除dart:html解决了一些错误。但是我发现了问题。整个飞镖环境都损坏了。遇到此服务器问题,在运行升级时,文件已损坏。结果,我遇到了那些错误。完全卸载所有内容,然后再次安装后,即可解决。谢谢大家
答案 1 :(得分:0)
尝试在您的initialize.dart中删除import 'dart:html';
答案 2 :(得分:0)
这里给出了几种解决方案
运行 flutter clean
命令并重新启动对我有用的 IDE
重启你的 Android Studio 应该可以解决这个问题
如果您使用的是 android studio,则: - 转到左上角图标选项 Android Studio -> 首选项 -> 插件 然后更新 dart 和 flutter,然后在终端中运行以下命令 1. flutter channel master 2. flutter clean 3. flutter clean cache 然后重新启动 android studio,它将运行没有任何错误