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.
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
lockfile
You can find lockfile
inside flutter installation directory.
<flutter folder>/bin/cache/lockfile
In Windows :
Press: Ctrl + Alt + Delete
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:
killall -9 dart
;But they all didn't work.
You can try to kill all flutter
processes.
TL;DR - go to point 4)
ps aux
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
We need content from second column (from above output):
ps aux | grep flutter | awk '{print $2}'
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With