首页 文章

无法在IntelliJ IDEA中运行新的颤振示例代码

提问于
浏览
1

我安装了IntelliJ IDEA,下载了flutter和dart插件,安装了android studio和jdk . 我打开配置的IntelliJ IDEA指向android sdk和jdk .
我打开了IntelliJ IDEA并创建了新项目 - > flutter . 我点击了构建并收到了一条错误消息 .

我使用的是Ubuntu 16.04 64位系统

我跑了Flutter Doctor并确认我没有任何新的或缺少安装 . 调试器中的消息如图所示

The built-in library 'dart:ui' is not available on the stand-alone VM. 
library handler failed export 'dart:ui' show Locale
Process finished with exit code 254 Failed to connect to the VM observatory service: java.io.IOException: Failed to connect: ws://127.0.0.1:46579/ws Caused by: de.roderick.weberknecht.WebSocketException: error while creating socket to ws://127.0.0.1:46579/ws Caused by: java.net.ConnectException: Connection refused

Standard new flutter project code with output

Debugger output which i copy pasted

4 回答

  • 0

    单击测试的名称,然后选择“编辑配置”您(可能)会注意到运行配置位于“dart”而不是“flutter test”

    删除这个,在“Flutter Test”下创建一个新的(使用加号按钮),然后手动选择/运行 .

    (此外,您需要在名为'test'的文件夹中将测试放在lib文件夹的同一级别(例如作为姐妹),并按照命名约定'* _test.dart'进行所有测试 . )

    快乐的编码!

  • 4

    听起来IntelliJ配置为作为Dart命令行应用程序而不是Flutter应用程序运行 . 编辑配置并删除任何看起来像“Dart Command Line App”的配置 . 然后为Flutter应用程序创建一个新的 .

  • 0

    当我遇到这个问题时,我通过关闭当前项目并创建一个新项目来修复错误 . 现在,当我试图从新项目运行应用程序时,它工作!希望它可以帮助某人 .

  • 5

    你的设置看起来不错!我认为IntelliJ正试图运行你的应用程序,好像它是一个命令行的飞镖应用程序,而不是一个颤动的应用程序 . IntelliJ中有一些设置允许您管理启动配置 . 我会:删除dart命令行为你的应用创建一个颤动(或确认一个存在)然后,从启动配置下拉菜单中,选择你的应用程序的颤动启动配置并点击运行 .

    这里有一些文档:https://flutter.io/intellij-ide/#running-and-debugging,虽然它们不包括创建启动配置 .

    参考enter link description here

相关问题