427

When I run my flutter application it show

Waiting for another flutter command to release the startup lock

this messages and not proceed further.

nvoigt
77.8k28 gold badges103 silver badges156 bronze badges
asked Aug 3, 2018 at 19:49
3
  • In My case , i open two diff project and I run the two commands on both 1) flutter build apk 2) flutter run. it stopped executing the other project and waited for the finishing of first project, as first projected finished its execution , second project started execution. Commented Dec 6, 2019 at 20:33
  • Below answers not needed. Just setup your sdk path in android studio. Close project, open project. Select pubspec.yaml run (Pub upgrade, Pub get, flutter doctor). Commented May 25, 2021 at 10:39
  • Follow the instructions here.. stackoverflow.com/a/66749569/20726550 Commented Jan 2, 2025 at 10:35

30 Answers 30

916

In my case, the following command in Terminal helped (as suggested by Günter Zöchbauer's comment):

killall -9 dart

On Windows, run the following in a Command Prompt or PowerShell window (as suggested by upupming's comment):

taskkill /F /IM dart.exe

(You can read about taskkill flags in Windows here)

TylerH
21.3k85 gold badges84 silver badges122 bronze badges
answered Dec 1, 2018 at 17:56
Sign up to request clarification or add additional context in comments.

2 Comments

then,how to proceed,im new to flutter, i just cloned the flutter git and set the env var?
I would suggest -9 as a last resort; attempting without it first would be preferred.
107

Remove this file:

<YOUR FLUTTER FOLDER>/bin/cache/lockfile

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

answered Oct 18, 2018 at 11:52

5 Comments

But the lockfile is locked. It is in use and I can't seem to delete it. OK, it works, but you need to close Android Studio and wait about a minute as well....then you can delete that file.
This answer is good if actually no application is using flutter i.e android studio, vscode, cmd, ... etc
it doesn't work. I delete it and run the command again same problem shows up. I am using ubuntu, never had this much issue in windows
Work for me, Thank you!
Great, thumbs up
39

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.

answered May 29, 2020 at 21:37

Comments

26

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.

answered Feb 28, 2019 at 9:00

Comments

23

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
Randika Vishman
8,1443 gold badges63 silver badges82 bronze badges
answered Jul 12, 2019 at 8:50

1 Comment

For me there's no dart task.
18

Most are saying killall -9 dart but nobody mentioned pkill -f dart which worked for me.

The difference between the 2 is explained here.

matthias_h
11.4k9 gold badges24 silver badges40 bronze badges
answered Mar 22, 2020 at 15:46

2 Comments

pkill -f dart worked for me on MacOs Ventura.
This worked for me too
12

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

geisterfurz007
5,9346 gold badges37 silver badges59 bronze badges
answered Jan 2, 2019 at 17:13

Comments

7

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.

enter image description here

answered Jun 4, 2020 at 7:22

Comments

6

I have tried all of below steps, but none worked.

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

Below is the final command that worked for me

rm -rf <flutter_dir>bin/cache/.upgrade_lock

Comments

5

This also happens when you have opened the flutter project in the Editor. Close the Editor and re-run the command

answered Aug 13, 2018 at 11:26

2 Comments

To add up to this, I am using vs code and I have to close all instances of vs code (e.g. api & flutter projects). Then I am able to re-run flutter run.
NOT WORKED DEAR :)
4

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

answered May 15, 2019 at 21:10

Comments

3

In VS code run

flutter clean

in the terminal. This fixed my issue.

code image

Paul Roub
36.5k27 gold badges88 silver badges95 bronze badges
answered May 20, 2020 at 18:24

Comments

3

I tried all the previous suggestions but no one solved the problem.. I did the following and it works (Windows 11):

  1. run command: taskkill /F /IM dart.exe in TERMINAL in VS code.
  2. close VS code.
  3. delete lockfile in <flutter_SDK_bath>\bin\cache.
  4. restart computer.
  5. run command: flutter doctor in Power Shell. (especially after updating flutter SDk).
  6. run command flutter pub get in application path.

that's works for me..

answered Jan 20, 2023 at 20:36

Comments

3

For me, this problem occurred when I downloaded and replaced the new version of Flutter. After searching for a long time, I realized that nothing should be done. At this moment, Android Studio is processing new files and folders. This message will be removed after approximately 4 minutes.

answered Jul 8, 2024 at 18:46

Comments

2
  1. Delete pubspec.lock file
  2. Run "flutter pub get" from terminal or editor shortcut ("get packages" AndroidStudio or this logo Visual Studio) in pubspec.yaml file.
  3. Wait for download.
  4. If it doesn't work relaunch your editor then repeat step 2..
answered Mar 22, 2020 at 12:42

Comments

2

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.

answered Sep 2, 2020 at 8:02

1 Comment

I had the same cause. brew upgrade flock - helped me
2

In 🍏 MacOS terminal run:

ps

If you see flutter or dart related process like this:

 PID TTY TIME CMD
 8166 ttys000 0:00.14 -zsh
 8199 ttys000 0:00.00 bash /Users/sabrina/devtools/flutter/bin/flutter zsh-completion
 8212 ttys000 0:00.00 bash /Users/sabrina/devtools/flutter/bin/flutter zsh-completion
 8222 ttys000 0:00.00 bash /Users/sabrina/devtools/flutter/bin/internal/update_dart_sdk.sh

Kill them using kill [PID] command, for example:

kill 8222
answered Sep 9, 2024 at 10:56

Comments

1
  1. Turn off Android Studio.

  2. Open flutter installation directory /bin/cache.

  3. Delete lockfile.

  4. At this point, you can execute the flutter related command on the command line to solve the problem perfectly.

Henrique Branco
1,9581 gold badge18 silver badges43 bronze badges
answered Apr 21, 2020 at 16:14

Comments

1

You can remove flutter and "install again", so fastest way is to:

1) Check where you have flutter (as executable)

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

3) Check is it git repository

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).

answered May 29, 2020 at 22:18

Comments

0

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.

answered Jun 3, 2019 at 11:08

Comments

0

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.

answered Dec 25, 2019 at 6:07

Comments

0

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.

answered Jan 22, 2020 at 10:10

Comments

0

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
answered Jun 1, 2020 at 18:17

Comments

0

Restart your computer or simple logout from the current user and login again.

TylerH
21.3k85 gold badges84 silver badges122 bronze badges
answered Apr 16, 2020 at 9:08

3 Comments

Please convince me logging out&in solves the problem. (And, if platform dependent or tried on one, only, mention the platform.)
using Mac OS Mojave
I faced similar issues and the above method solved my problem
0

i had same issue , in terminal executed this command

taskkill /F /IM dart.exe

and Flutter Clean , Flutter pub get then restarted the pc and it worked.

answered Jul 11, 2023 at 10:19

Comments

0
  • In the terminal type flutter packages get
  • Type flutter clean

If it doesn't work do this:

  • Type killtask /f /im dart.exe.

Close Android Studio and then restart your PC.

answered Sep 22, 2023 at 21:03

Comments

0

I tried most of the answers here, but what I believe is happening is that there is some hidden dart process running when you open any app like VSCode or Android Studio. My steps were a lot simpler to solve this:

  • Shut off your computer (don't just restart it) and turn it back on
  • Don't open VSCode or Android Studio
  • If there's any dart process running, kill it with task manager or with the commands provided by the folks here
  • Go to {FlutterDirectory}/bin/cache and delete everything there (it's just cache so doesn't matter)
  • Open terminal
  • Run flutter clean

I believe the flutter/dart extension for VSCode might lock it if you try to run flutter clean in VSCode, but you can try it

answered Oct 12, 2023 at 13:40

Comments

0

For my case i was not connected to the internet and if you have setup a firewall just allow dart to connect.

answered Apr 30, 2024 at 16:49

Comments

0

For Windows users, the best option that worked for me was to end the dart task from the Task Manager. Here's a screenshot below: end all the dart task

answered Oct 24, 2024 at 10:53

Comments

0

After trying most of the things above and none works, what i did was to just move the flutter folder from the path to bin, and then replace it back and it works.

answered Dec 16, 2024 at 10:33

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.