2

I installed IntelliJ IDEA, downloaded both the flutter and dart plugins, Installed android studio and jdk . I opened configured IntelliJ IDEA to point at the android sdk and jdk.
I opened up IntelliJ IDEA and created new project->flutter. I clicked on build and got an error message.

I am using Ubuntu 16.04 64 bit system

I ran Flutter Doctor and confirmed that i got nothing new or missing installation. The message at debugger is as shown

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

6 Answers 6

9

It sounds like IntelliJ is configured to run as a Dart command line app instead of a Flutter app. Edit configurations and remove any configurations that look like "Dart Command Line App". Then create a new one for a Flutter app.

Sign up to request clarification or add additional context in comments.

Comments

6

Click the name of the test, and choose "Edit configurations" You'll (probably) notice that the run config is under 'dart' rather than 'flutter test'

Delete this one, create a new one (using the plus button) under 'Flutter Test' and choose / run this manually.

(Also, you need to have the tests in a folder called 'test' at the same level (e.g. as a sister to) the lib folder, and follow the naming convention '*_test.dart' for all tests.)

Happy coding!

1 Comment

Searching for ages, and this was the answer... thanks!
1

I had same issue on Android Studio and I find out that its related to the file (configuration) selected here:

enter image description here

The first one is Dart Command Line App and the second one is Flutter App which should be selected

Comments

1

I ran into this issue on VS Code and the solution is: If you are using VS Code then instead of hitting Run (Ctrl+Alt+N) go to Debug -> Start Debugging option or simply press F5 and errors will be gone

Comments

0

When i encountered this issue, I fixed the error by simply by closing the current project and creating a new project. Now when i tried to run the app from the new project, it worked!. Hope it helps someone.

2 Comments

So you create a new project every time?
@EyoelD This may not be the best option, but it worked for me, and this was when flutter was still in beta.
0

Your setup looks good! I think IntelliJ is trying to run your app as if it was a command-line dart app, not a Flutter one. There are some settings in IntelliJ to allow you to manage your launch configs. I would: delete the dart command-line one create a flutter one for your app (or confirm that one exists) Then, from the launch config drop-down, select the flutter launch config for your app and hit run.

There are some docs here: https://flutter.io/intellij-ide/#running-and-debugging, though they don't cover creating a launch config.

Referenter link description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.