Waiting for another flutter command to release the startup lock
FlutterCommandLockfileFlutter CompilerFlutter Problem Overview
When I run my flutter application it show
> Waiting for another flutter command to release the startup lock
this messages and not proceed further.
Flutter Solutions
Solution 1 - Flutter
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
Solution 2 - Flutter
Remove this file:
<YOUR FLUTTER FOLDER>/bin/cache/lockfile
This releases the occupied lock and makes you able to run other commands.
Solution 3 - Flutter
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
lockfile
2. Remove You can find lockfile
inside flutter installation directory.
<flutter folder>/bin/cache/lockfile
Solution 4 - Flutter
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
Solution 5 - Flutter
You can try to kill all flutter
processes.
TL;DR - go to point 4)
1) List of the processes:
ps aux
flutter
:
2) Search name containing with 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.
Solution 6 - Flutter
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:
- Delete lockfile;
- Run
killall -9 dart
; - Restart my PC.
But they all didn't work.
Solution 7 - Flutter
Exit from your IDE, then from start manager stop all dart related files(if any have).
Then go to
"FLUTTER DIRECTORY"/bin/cache/lockfile
and delete this lockfile
Solution 8 - Flutter
Most are saying killall -9 dart
but nobody mentioned pkill -f dart
which worked for me.
The difference between the 2 is explained here.
Solution 9 - Flutter
try this instead For Window
> TASKKILL //F //IM dart.exe
This worked!
Solution 10 - Flutter
I have the same issue, I tried all the above solutions, but none of them worked for me. Then I searched the keywords in flutter directory, and found the following code. So I tried to delete bin/cache/.upgrade_lock
, and it worked finally.
Solution 11 - Flutter
This also happens when you have opened the flutter project in the Editor. Close the Editor and re-run the command
Solution 12 - Flutter
thanks, Dear all for the right answer, I am using Flutter on Ubuntu
killall -9 dart
this command helps resolve this issue for me as well
Solution 13 - Flutter
I tried all previous suggestions but without benefit. Finally when I connect my pc to internet and wait flutter to release then 5 minutes solved
Solution 14 - Flutter
Solution 15 - Flutter
I have tried all of below steps, but none worked.
- Delete lockfile;
- Run killall -9 dart;
- Restart my PC.
Below is the final command that worked for me
rm -rf <flutter_dir>bin/cache/.upgrade_lock
Solution 16 - Flutter
- Delete pubspec.lock file
- Run "flutter pub get" from terminal or editor shortcut ("get packages" AndroidStudio or this logo Visual Studio) in pubspec.yaml file.
- Wait for download.
- If it doesn't work relaunch your editor then repeat step 2..
Solution 17 - Flutter
For me, the issue's root cause on my Mac device was a version of the flock binary it was not expecting. Removing it from the path did the trick; probably a BSD vs GNU syntax issue.
Solution 18 - Flutter
If you are using Windows, you can open the task manager and under the 'Processes' tab search for processes named 'dart'. End all those tasks.
Solution 19 - Flutter
For Newbies
The simplest solution, although a little time consuming would be to restart your computer or simple logout from the current user and login again.
Solution 20 - Flutter
You can remove flutter and "install again", so fastest way is to:
flutter
(as executable)
1) Check where you have To check it, you can run:
which flutter
And you can expect such output:
/your_user/your_path/flutter/bin/flutter
2) Go to this directory
Above path is directly to flutter, but we would like to go to directory so "one earlier" in path:
cd /your_user/your_path/flutter/bin
git
repository
3) Check is it It should be, but it's worth to check.
Run one of the git command e.g.
git status
or
git branch
When it's git repository you will receive some info about it or correct list of branches.
4) Remove all of the files
rm -R *
5) "revert" removal to have only necessary files:
git co -- .
6) Voila!
You can run just flutter version
and commands should work (and Flutter will fetch some necessary data).
Solution 21 - Flutter
In Android Studio, It's Work for me
Stop your app if it still runs on the phone or disconnect the your testing device.
Then try to install the package again.
Solution 22 - Flutter
There are some action to do:
1- in pubspec.yaml press "packages get" or in terminal type " flutter packages get" and wait seconds.
if this doesn't work :
2-type flutter clean then do step(1)
if this doesn't work too :
3-type killtask /f /im dart.exe
if this doesn't work too :
4- close android studio and then restart your pc.
Solution 23 - Flutter
Restart your IDE first and then run the following command in project folder from terminal
killall -9 dart
It worked for me. Hope it will help some of the guys facing the same problem.
Solution 24 - Flutter
-
Turn off Android Studio.
-
Open flutter installation directory /bin/cache.
-
Delete lockfile.
-
At this point, you can execute the flutter related command on the command line to solve the problem perfectly.
Solution 25 - Flutter
It seems like a network issue. I turned off my wi-fi and connected my laptop on a 4G connection by my phone an it works in 5,9s
Solution 26 - Flutter
I just left the terminal open for a minute. then it started working fine again.
Solution 27 - Flutter
Nothing of ALL these answers didn't helped me.
The only one solution was to remove whole flutter stuff (and reinstall flutter from git):
<flutter directory>
<user>/.flutter_tool_state
<user>/.dart
<user>/.pub-cache
<user>/.dartServer
<user>/.flutter
Solution 28 - Flutter
I also faced same issue i followed the best and the easiest way
Environment : Windows
IDE : Android Studio
Tools>flutter(last option)> select flutter clean
after flutter clean finished you all set and good to go.
Solution 29 - Flutter
This occurs when any other flutter command is running in background. To solve this you can run for mac
killall -9 dart
and for windows open task manager. Then in processes tab, search for dart process and kill all of them. Hope this helps you.
Solution 30 - Flutter
Did most of the previous solutions but it didn't work for me so i just left the laptop connected to the internet with VS-code opened then i switched if off for a while and put it back on and it worked
Solution 31 - Flutter
On Mac remove hidden file: <FLUTTER_HOME>/bin/cache/.upgrade_lock
Solution 32 - Flutter
This worked for me:
-
Restart your IDE
-
Fun the following command
flutter clean
Solution 33 - Flutter
Just Do that!!!
Do not create a project within the Flutter SDK directory.
Create your project in another directory.
Then It will work properly
If you can solve this problem please Rate this answer.
Thanks for your support
Solution 34 - Flutter
Just type this on android studio terminal and will work again!
flutter run
:)