Oops; flutter has exited unexpec
2019-06-10 本文已影响2人
锦岳
Linux 系统下,使用命令 flutter doctor
时,报了如此的错误。
本机用户名为 karl,flutter/ 放置在 /home/karl/opt/ 下。
根据提示,打开位于 /home 下的文件 flutter_01.log,报错内容如下所示
Flutter crash report; please file at https://github.com/flutter/flutter/issues.
## command
flutter doctor
## exception
FileSystemException: FileSystemException: Cannot open file, path = '/home/karl/opt/flutter/version' (OS Error: Permission denied, errno = 13)
`` `
#0 _File.open.<anonymous closure> (dart:io/file_impl.dart:364:9)
#1 _rootRunUnary (dart:async/zone.dart:1132:38)
#2 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#3 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#4 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#5 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#6 Future._completeWithValue (dart:async/future_impl.dart:483:5)
#7 Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:513:7)
#8 _rootRun (dart:async/zone.dart:1124:13)
#9 _CustomZone.run (dart:async/zone.dart:1021:19)
#10 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#11 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#12 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#13 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#14 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)
`` `
## flutter doctor
`` `
�[32m[✓]�[39m Flutter (Channel dev, v1.7.4-pre.27, on Linux, locale en_US.UTF-8)
�[32m•�[39m Flutter version 1.7.4-pre.27 at /home/karl/opt/flutter
�[32m•�[39m Framework revision d198e3871f (21 hours ago), 2019-06-09 00:19:28 -0400
�[32m•�[39m Engine revision afed5c5476
�[32m•�[39m Dart version 2.3.2 (build 2.3.2-dev.0.1 7f146e431e)
�[32m[✓]�[39m Android toolchain - develop for Android devices (Android SDK version 28.0.3)
�[32m•�[39m Android SDK at /home/karl/android-sdk
�[32m•�[39m Android NDK location not configured (optional; useful for native profiling
support)
�[32m•�[39m Platform android-28, build-tools 28.0.3
�[32m•�[39m ANDROID_HOME = /home/karl/android-sdk
�[32m•�[39m Java binary at: /home/karl/opt/android-studio/jre/bin/java
�[32m•�[39m Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b16-5323222)
�[32m•�[39m All Android licenses accepted.
�[32m[✓]�[39m Android Studio (version 3.4)
�[32m•�[39m Android Studio at /home/karl/opt/android-studio
�[32m•�[39m Flutter plugin version 36.0.1
�[32m•�[39m Dart plugin version 183.6270
�[32m•�[39m Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b16-5323222)
�[33m[!]�[39m IntelliJ IDEA Community Edition (version 2019.1)
�[32m•�[39m IntelliJ at /home/karl/opt/idea-IC
�[31m✗�[39m Flutter plugin not installed; this adds Flutter specific functionality.
�[31m✗�[39m Dart plugin not installed; this adds Dart specific functionality.
�[32m•�[39m For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
�[32m[✓]�[39m VS Code (version 1.35.0)
�[32m•�[39m VS Code at /usr/share/code
�[32m•�[39m Flutter extension version 3.1.0
�[33m[!]�[39m Connected device
�[33m!�[39m No devices available
�[33m!�[39m Doctor found issues in 2 categories.
`` `
出错原因是 OS Error: Permission denied, errno = 13
,权限问题,这样就可以确定如何解决了。
解决方案:
- 将 flutter/ 以及其中的文件与文件夹移动到其他父文件夹下。
- 授予 flutter/ 文件夹所有权限:
sudo chmod -R 777 /home/karl/opt/flutter/