I am developing an app using flutter on macOS. When i switch to windows machine for developing, it shows the following error
Oops; flutter has exited unexpectedly. Sending crash report to Google. Crash report sent (report ID: 4c15631f67927e73) Crash report written to D:\hcbmobile\flutter_11.log; please let us know at https://github.com/flutter/flutter/issues.
I have already created issue in this link: https://github.com/flutter/flutter/issues/33645
The generated log file shows the following crash report:
flutter run --machine -t lib\main.dart -d B3698Y11HA4122 --track-widget-creation --start-paused
FileSystemException: FileSystemException: Cannot open file, path = 'D:\hcbmobile.flutter-plugins' (OS Error: Access is denied. , errno = 5)
#0 _File.throwIfError (dart:io/file_impl.dart:643:7)
#1 _File.openSync (dart:io/file_impl.dart:487:5)
#2 _File.writeAsBytesSync (dart:io/file_impl.dart:612:31)
#3 _File.writeAsStringSync (dart:io/file_impl.dart:636:5)
#4 _LocalFile&LocalFileSystemEntity&ForwardingFile.writeAsStringSync (package:file/src/forwarding/forwarding_file.dart:147:16)
#5 _writeFlutterPluginsList (package:flutter_tools/src/plugins.dart:104:17)
#6 refreshPluginsList (package:flutter_tools/src/plugins.dart:297:24)
#7 FlutterProject.ensureReadyForPlatformSpecificTooling (package:flutter_tools/src/project.dart:175:5)
<asynchronous suspension>
#8 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:478:21)
<asynchronous suspension>
#9 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:424:33)
<asynchronous suspension>
#10 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:29)
<asynchronous suspension>
#11 _rootRun (dart:async/zone.dart:1124:13)
#12 _CustomZone.run (dart:async/zone.dart:1021:19)
#13 _runZoned (dart:async/zone.dart:1516:10)
#14 runZoned (dart:async/zone.dart:1463:12)
#15 AppContext.run (package:flutter_tools/src/base/context.dart:152:18)
<asynchronous suspension>
#16 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:415:20)
#17 CommandRunner.runCommand (package:args/command_runner.dart:196:27)
<asynchronous suspension>
#18 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:396:21)
<asynchronous suspension>
#19 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:29)
<asynchronous suspension>
#20 _rootRun (dart:async/zone.dart:1124:13)
#21 _CustomZone.run (dart:async/zone.dart:1021:19)
#22 _runZoned (dart:async/zone.dart:1516:10)
#23 runZoned (dart:async/zone.dart:1463:12)
#24 AppContext.run (package:flutter_tools/src/base/context.dart:152:18)
<asynchronous suspension>
#25 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:356:19)
<asynchronous suspension>
#26 CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:111:29)
#27 new Future.sync (dart:async/future.dart:224:31)
#28 CommandRunner.run (package:args/command_runner.dart:111:11)
#29 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:242:18)
#30 run.<anonymous closure> (package:flutter_tools/runner.dart:60:20)
<asynchronous suspension>
#31 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:29)
<asynchronous suspension>
#32 _rootRun (dart:async/zone.dart:1124:13)
#33 _CustomZone.run (dart:async/zone.dart:1021:19)
#34 _runZoned (dart:async/zone.dart:1516:10)
#35 runZoned (dart:async/zone.dart:1463:12)
#36 AppContext.run (package:flutter_tools/src/base/context.dart:152:18)
<asynchronous suspension>
#37 runInContext (package:flutter_tools/src/context_runner.dart:54:24)
<asynchronous suspension>
#38 run (package:flutter_tools/runner.dart:51:10)
#39 main (package:flutter_tools/executable.dart:59:9)
<asynchronous suspension>
#40 main (file:///D:/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#41 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:298:32)
#42 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:171:12)
[✓] Flutter (Channel dev, v1.6.6, on Microsoft Windows [Version 10.0.17134.765], locale en-US)
• Flutter version 1.6.6 at D:\flutter
• Framework revision e1a784ae3f (2 days ago), 2019-05-28 21:53:03 -0700
• Engine revision 8dc3a4cde2
• Dart version 2.3.2 (build 2.3.2-dev.0.0 e3edfd36b2)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\USER\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: D:\android\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.3)
• Android Studio at D:\android
• Flutter plugin version 33.3.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[✓] Connected device (1 available)
• Symphony P7 PRO • B3698Y11HA4122 • android-arm64 • Android 6.0 (API 23)
• No issues found!
I have already tried flutter clean and flutter upgrade, but it did not work.
答案 0 :(得分:1)
我试图在 vs 代码终端中使用命令“flutter create”创建一个 flutter 项目,但我收到了这个错误
对我有用的是我关闭了 vsCode 并使用 powershell 而不是 vsCode 终端来创建项目,幸好它没有显示任何错误
答案 1 :(得分:0)
只需删除项目文件夹中的.flutter-plugins文件即可。
答案 2 :(得分:0)
我在使用 Android Studio 创建 flutter 项目时第一次遇到此错误。然后我也尝试 vs 代码和命令提示符。我遇到了同样的错误。
这些步骤帮助我修复错误;
1.删除现有的flutter文件夹。
2.转到此链接:flutter.dev/docs/get-started/install/
3.在新文件夹中再次安装flutter。 (仔细按照说明操作。)
不要将 Flutter 安装在像 C:\Program Files\ 这样需要提升权限的目录中。
4.再次设置环境变量。
5.run flutter doctor
(如果一切设置正确,就不会出现错误。)
6.在您的项目目录中创建一个项目。
完成:)