Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Waiting for another flutter command to release the startup lock

People also ask

What is flutter Run command?

The flutter run command will run your application on a connected device, or iOS simulator, or Android Emulator. You can also use --verbose command to get a detailed log while running the application.


In my case, following command in Terminal helped (as suggested by Günter):

killall -9 dart

On Windows (as suggested by upupming):

taskkill /F /IM dart.exe

Remove this file:

<YOUR FLUTTER FOLDER>/bin/cache/lockfile

This releases the occupied lock and makes you able to run other commands.


1. Stop all running dart instances

If you're using Android Studio save your work and close it. And open your terminal to kill running dart instances.

Those commands will kill all dart instances including the ones created by editors for code analysis and debug instances. So be careful before executing

Linux:

killall -9 dart

Windows:

taskkill /F /IM dart.exe

2. Remove lockfile

You can find lockfile inside flutter installation directory.

<flutter folder>/bin/cache/lockfile

In Windows :

Press: Ctrl + Alt + Delete

  • In task manager find out your editor such as VS Studio or Android Studio
  • In that Find "dart" and End that Task
  • Then close your editor
  • Open editor again
  • let editor to complete all things, after that run your query that will work

I use a Mac with Visual Studio Code and this is what worked:

Shutdown your PC and switch it on again. Don't use the restart function. I restarted 2 times and it didn't work. Only shutdown worked.

PS: I tried out the following:

  1. Delete lockfile;
  2. Run killall -9 dart;
  3. Restart my PC.

But they all didn't work.


You can try to kill all flutter processes.

TL;DR - go to point 4)

1) List of the processes:

ps aux

2) Search name containing with flutter:

ps aux | grep flutter

where output can be like there:

stackoverflow     16697   1.5  0.0  4288316    704   ??  S    10:02PM   0:15.80 bash /flutter_path/flutter/bin/flutter --no-color build apk
stackoverflow      2800   1.5  0.0  4288316    704   ??  S     9:59PM   0:18.49 bash /flutter_path/flutter/bin/flutter --no-color pub get
stackoverflow      1215   1.5  0.0  4280124    700   ??  S     9:58PM   0:18.89 bash /flutter_path/flutter/bin/flutter --no-color config --machine
stackoverflow      8449   1.5  0.0  4296508    716   ??  S    10:00PM   0:17.20 bash /flutter_path/flutter/bin/flutter --no-color pub get
stackoverflow      1326   1.4  0.0  4288316    708   ??  S     9:58PM   0:18.97 bash /flutter_path/flutter/bin/flutter daemon
stackoverflow     16687   0.0  0.0  4279100    820   ??  S    10:02PM   0:00.01 bash /flutter_path/flutter/bin/flutter --no-color build apk
stackoverflow      8431   0.0  0.0  4288316    804   ??  S    10:00PM   0:00.02 bash /flutter_path/flutter/bin/flutter --no-color pub get
stackoverflow      2784   0.0  0.0  4288316    704   ??  S     9:59PM   0:00.01 bash /flutter_path/flutter/bin/flutter --no-color pub get
stackoverflow      1305   0.0  0.0  4280124    712   ??  S     9:58PM   0:00.01 bash /flutter_path/flutter/bin/flutter daemon
stackoverflow      1205   0.0  0.0  4279100    788   ??  S     9:58PM   0:00.01 bash /flutter_path/flutter/bin/flutter --no-color config --machine
stackoverflow     11416   0.0  0.0  4268176    536 s000  R+   10:18PM   0:00.00 grep --color flutter

3) Get processes ID

We need content from second column (from above output):

ps aux | grep flutter | awk '{print $2}'

4 a) Kill "automatically":

To list, search and kill all of them you can use

kill $(ps aux | grep flutter | grep -v grep  | awk '{print $2}')

(you can run it also with sudo)

or

ps aux | grep flutter | grep -v grep | awk '{print $2}' | xargs kill -15

4 b) Kill manually

You can kill processes one-by-one using:

sudo kill -15 <process_ID>

e.g. to kill process with id 13245 use:

sudo kill -15 13245

If -15 will not work, you can try -2 or -1.

Final option it is -9 which should not be used because it prevents the process from doing any cleanup work.