Failed to start DevTools: Dart DevTools exited with code 255 - flutter

I am getting this error code in my Visual Studio Code. How can I fix it?
I am using Flutter v2.5.3.

You can try fixing it by running this in the terminal:
Just copy and paste the below code into the terminal and run it.
dart pub global activate devtools -v 2.8.0
which downgrades the version to 2.8.0 (that works fine). I found the answer on GitHub.

I agree with RandomCoder's answer to avoid executing command
dart pub global activate devtools -v 2.8.0
every time before opening Visual Studio Code.
And also if you didn't know the location of the build folder mentioned by RandomCoder, I found the location after reading it here for the pub cache folder:
By default, this directory is located under . pub-cache in your home directory (on macOS and Linux), or in %LOCALAPPDATA%\Pub\Cache (on Windows). (The precise location of the cache may vary depending on the Windows version.)
After you found it, go to the \hosted\pub.dartlang.org\devtools-2.8.0 directory to copy the build version there and paste it in \hosted\pub.dartlang.org\devtools-2.9.2.
I still didn't know if there is any bad effects of copy pasting it to a newer version folder, but in my case it's working until now.

In my case there wasn’t any build folder in the devtools-2.9.2 folder.
I copied it from 2.8.0 and it now works.

For Android Studio
Close Android Studio
Rn dart pub global activate devtools -v 2.8.0 to downgrade (as suggested in a previous answer)
Open Android Studio
Run your build
For Visual Studio Code
Open Terminal
Run dart pub global activate devtools -v 2.8.0 to downgrade (as suggested a previous answer)

I fix this by:
flutter upgrade

This is an issue coming since yesterday. Maybe they must have updated the Dart engine.
There are two ways which will help you to solve the issue.
Update the Flutter SDK to the latest version and restart your PC:
flutter upgrade
Use the Dart Devtools manually
Run flutter pub global in another terminal. Run devtools and then open http://127.0.0.1:9100
Enter a running application field address of your running application in the Connect: "http://127.0.0.1:60230/J7_wS_YhTuo=/"
You can find this URL in debug console when you run the code.
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:51849/mHlycLJYEWw=/ws
If you are getting any issue regarding the port, then do this in your Flutter project console
flutter run --observatory-port=9100
Once the application starts you can see the message in the console.
If you are getting any server issue in the web browser
then enter
dart devtools
In cmd

Downgrade to devtools-2.8.0
And activate using dart pub global activate devtools -v 2.8.0
These two steps worked in my case

First activate your devtool using this command...
flutter pub global activate devtools
flutter pub global run devtools
And after that, try launching it from Visual Studio Code as described in the documentation: Install and run DevTools from VS Code

Related

Invalid argument(s: A directory corresponding to fileSystemPath /Users/user/.pub-cache/hosted/pub.dartlang.org/devtools-2.9.2/build could not be found

Somehow the "build" directory doesn't exist within devtools-2.9.2 directory. I am getting this exception only while running the build on iPhone SE 2nd generation iOS 14.5 simulator though, which is weird. This began after an unexpected forced reboot of my mac. But I can not directly connect this event.
What is happening and how can I build this stuff or get rid of exceptions? And what is the cause?
flutter doctor -v No issues found
It seems like the new 2.9.2 release doesn't have the required "build" folder.
You can try fixing it by running this in the terminal:
dart pub global activate devtools -v 2.8.0
which downgrades the version to 2.8.0 (that works fine).
Answer from github.
run the following code and it'll get solved.
dart pub global activate devtools -v 2.8.0
DevTools is no longer being shipped via pub and is now part of the Dart SDK. 2.9.2 was published unintentionally this morning and has since been retracted.
How were you starting DevTools? You might want to file an issue on the DevTools repository if you're still having issues and I (#bkonyi) can help you out further there.

Could not find an option named "devtools-server-address". when trying to run flutter app from AndroidStudio

I just updated Flutter plugin to 53.0.1, restarted Android Studio and hit "run" button and the error below show up:
Could not find an option named "devtools-server-address".
Close and reopen AndroidStudio resolved for me!
killall java
I downgraded from Flutter 2.0 to Flutter 1.22.5 and got this error.
To solve it,
Go to your terminal and write flutter channel stable.
Then run flutter doctor.
Now you may get another error like this -
If you have Flutter & Dart plugins already install, just ignore this error. This is a bug in Flutter 1.22.5 .
Just run the app and it will work fine!
I had the same issue but using VS Code on stable channel
Execute the following commands:
flutter channel stable
flutter upgrade
flutter clean
flutter pub get
Then, close and open your IDE
Follow the steps:
File -> Invalidate Cache and Restart. Run flutter clean Worked For me.
This so simple... Open terminal type flutter channel dev this solve your problem.
And after that flutter upgrade
Finally, flutter doctor
If it does not help:
Open terminal type flutter channel stable
And after that flutter upgrade
Finally, flutter doctor
Working without upgrading flutter
Safe fix for Mac (Android Studio 4.1+). It is in a different directory now, but the symbolic link helps.
Just run this command in the Terminal:
ln -s ~/Library/Application\ Support/Google/AndroidStudio4.1/plugins ~/Library/Application\ Support/AndroidStudio4.1
Change the version of the Android studio depending on what you have, I had 4.2 so used.
ln -s ~/Library/Application\ Support/Google/AndroidStudio4.2/plugins ~/Library/Application\ Support/AndroidStudio4.2
Just Invalidate Cache and Restart. Worked for me.
Just close your all project and also close Android Studio and Reopen.

Execution failed for task ':app:cleanMergeDebugAssets' while running the app in flutter

Main error while running the app in Visual Studio Code v1.46.1
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:cleanMergeDebugAssets'.
> Unable to delete directory 'E:\ACNO\Flutter\jots_mobile\build\app\intermediates\merged_assets\debug\out'
Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
- E:\ACNO\Flutter\jots_mobile\build\app\intermediates\merged_assets\debug\out\flutter_assets\assets
- E:\ACNO\Flutter\jots_mobile\build\app\intermediates\merged_assets\debug\out\flutter_assets\packages\cupertino_icons
- E:\ACNO\Flutter\jots_mobile\build\app\intermediates\merged_assets\debug\out\flutter_assets\packages
- E:\ACNO\Flutter\jots_mobile\build\app\intermediates\merged_assets\debug\out\flutter_assets
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 50s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
This error gets resolved after flutter clean but even that shows the following error
Below is the output of flutter clean
Failed to remove build. A program may still be using a file in the directory or the directory itself. To find and stop such a program, see:
https://superuser.com/questions/1333118/cant-delete-empty-folder-because-it-is-used
Deleting build... 19ms
Failed to remove E:\ACNO\Flutter\jots_mobile\.dart_tool. A program may still be using a file in the directory or the directory itself. To find and stop such a program, see:
https://superuser.com/questions/1333118/cant-delete-empty-folder-because-it-is-used
Deleting .dart_tool... 21ms
Deleting Generated.xcconfig... 4ms
Deleting flutter_export_environment.sh...
Even when I kill the processes which are using build and .dart_tool folders as mentioned in this answer, flutter clean will show the same error
So, now I've to manually go to file explorer and delete the build & .dart_tool folders, which is the main issue here!
Summary: Main error while running the app gets resolved after flutter clean but even that is showing an error, so now I've to manually go and delete build & .dart_tool folders!
Q. How can I resolve these issues?
Update: Just noticed that this error occurs when I use "f5" to run my program in VS code and not when I use flutter run command in terminal or in Android Studio, but once it has occurred with "f5", it happens with flutter run command and Android Studio both. There is something wrong with the extension in VS Code that enables this "f5" shortcut, I guess!
Checkout these GitHub issues • flutter/flutter • fwcd/vscode-kotlin
The problem was with the Kotlin plugin in VS Code, so removing it should fix our problem!
Now I able to run the project in debug mode. Below is my flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.17.4, on Microsoft Windows [Version 10.0.17763.1282, locale en-MY)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.46.1)
[√] VS Code, 64-bit edition (version 1.46.1)
[√] Connected device (1 available)
I reinstall the Kotlin plugin in VS Code, the problem came back. I removed it, the project runs. So I guess its the plugin. The plugin I used and removed is Kotlin 0.2.17
Can anyone double-check whether the problem is because of this?
Uninstalling the Kotlin 0.2.18 extension on VSCode worked for me. I didn't need to delete the build and .dart_tool files mentioned above.
At the moment I solved using "sudo" mode.
sudo flutter run
I don't have installed Kotlin on VSCode.
I hope to help something
To resolve this, you have to forcefully delete your merged_assets folder and all of its content (i.e 'E:\ACNO\Flutter\jots_mobile\build\app\intermediates\merged_assets\debug\out') since Flutter isn't able to do that for you because one or two programs are using the folders at the background.
To delete the folder forcefully, you can download this exe file: https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer
Then, search for 'merged_assets' in the Find tab. Click on the applications using it and kill them (usually dart.exe and cmd.exe).
After this, run flutter clean
Then re-run your app, it should work successfully.
this problem happen because, some other programs used the same files you need to start compile and run your app, one of the program is live Server, make sure to close it, and close any other programs using this app resources 'files' need to compile .
Write in terminal
cd android
.\gradlew clean
cd ..
and run your progict agin
Or
Enter build file and delete app file
If not working
Enter build file and delete everything inside it
Warning: prefer do a cut and put it in another place.
Because if not working, Returns it in build file again
I did not had the VSCODE KOTLIN plug-in. I just closed VSCODE
and from an elivated (admin) CMD-terminal run
Flutter run
It worked great!!

Flutter SDK Is Not Found In The Specified Location

I'm extremely frustrated right now after I updated Android Studio to have the latest Flutter and Dart Plugins. Now it tells me "No FLutter SDK configured" and when I give it the SKD path it just says, "Flutter SDK Is Not Found In The Specified Location." The Dart plugin works fine.
I have looked for an answer for hours and nothing works. I've downloaded the NDK, flutter doctor works perfectly, and I've tried set the SDK path to pretty much every file inside my flutter folder (inside /Documents).
Any tips?
Go to - Configure -> Tools > SDK Manager > Android SDK > SDK Tools, and search for flutter. You will get flutter SDK for Android.
If you are using Visual studio, also install plugins for flutter in Visual Studio.
» Steps:
Download Flutter SDK: Here
Extract Flutter:
tar xf ~/Downloads/flutter_linux_v1.7.8+hotfix.4-stable.tar.xz
Path export for particular terminal:
export PATH="$PATH:`pwd`/flutter/bin"
Permanent Path export:
Open bashrc file: Go to home directory terminal -> nano ~/.bashrc
Write at end of file:
export PATH=" [PATH_Where_Flutter SDK Extracted] /flutter/bin:$PATH"
example: export PATH="/home/sid/0_aaa_iauro/Flutter/s/flutter/bin:$PATH"
Run the following command to see if there are any dependencies you need to
install to complete setup:
flutter doctor -v
Add Flutter extension to vs-code.
Locate Flutter SDK.
Make New project in flutter:
flutter create Project_name
» Important Links:
Linux Install
Getting Started with Flutter on Linux for Android [Beginner Tutorial]
How To Install And Setup Flutter On Ubuntu 18.04.1 LTS (Bionic Beaver)
Part 2-A: Install Flutter in Windows – Step by Step Guide
Check for path variable (bashrc file):
Flutter – Step by Step Installation on Linux – Ubuntu
If you are using a fresh new Android Studio install as me, try installing missing packages for SDK support in Android Studio as described here: https://ladwhocodes.blogspot.com/2019/02/fix-flutter-sdk-not-found-in-specified-location.html
Go to Menu > Tools > SDK Manager > Android SDK (left side of the dialog) > SDK Tools (tab).
Select 'Support Repository' and 'NDK' checkboxes.
Click OK.
It will prompt you to install some dependencies. Install them.
What happen to me was because there is a space in my android sdk path (which is my username). I copy to C:\android\sdk and problem gone. Probably the space cause issue to NDK thus affect to Flutter sdk.
in my case, it was caused by local changes to the flutter git repo. On command line, everything worked, but in Android Studio it failed to detected the flutter sdk which caused all flutter commands to fail (even though flutter bin dir is in my path). The local changes were probably caused by trying out the beta version of flutter and returning to stable afterwards.
solution: delete flutter dir and redownload (I actually reverted all changes using the git clean command)

Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds

Log:
E:\Flutter>flutter doctor Checking Dart SDK version... Downloading
Dart SDK from Flutter engine ead227f a... Unzipping Dart SDK...
Updating flutter tool... Error: Unable to 'pub upgrade' flutter tool.
Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
First Make sure you have a working internet connection and if this issue still exists then, this error may be because the dart sdk may have not been properly downloaded.
The simplest solution is to delete the cache folder located in
flutter/bin(location where flutter is installed) and then Run flutter doctor
I fix that by:
Ctrl+C to stop infinite error loop.
Kill the Dart process in Windows Task Manager.
Delete the cache folder located in flutter/bin directory.
Run in command line flutter pub cache repair.
After that I run flutter doctor and get predictable results:
e:\tools>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version
6.1.7601], locale ru-RU)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.6)
[!] IntelliJ IDEA Community Edition (version 2019.2)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.44.2)
[√] Connected device (1 available)
! Doctor found issues in 2 categories.
I found my antivirus blocks pub upgrade,I had same issue while hitting flutter doctor, I turned off my antivirus and tried to run "flutter doctor" again, and worked well!
windows:
simplest and easiest way is download the latest version flutter sdk. replace manually current folder by pasting downloaded flutter folder instead of the current folder
in c drive. always choose replace and paste.
after finishing that check with flutter doctor. my issue solved
Solved this issue when Run the CMD as administrative.
This issue will come in protected network as well as due to anti-virus. Even I was facing the same. I downloaded latest stable version manually from the following link, which doesn't required any update process and it works for now..
Download Link For Flutter in Zip format
I updated the flutter SDK via git pull, then the flutter doctor command works.
Just delete the cache folder in flutter/bin and run flutter doctor again!!
Just Deactivate your antivirus and run it again. It would work fine. I had the same issue before.
I deactivated my antivirus for some time and executed flutter doctor command once again in cmd and got fruitful results after hours of patience.
One more thing to note, you should ensure that path of dart-sdk folder should be added to the path in user variables.
It seems it is not being able to "unzip" the downloaded Dart file because it misses 7-zip uncompressor.
I installed it and it worked! It will deal with .7z files.
I hope it works for other people too!!
I had the same problem and it was solved.
Steps:
Download Dart and Filters SDK then Decompress these files and move them to this directory.
C: \
Define the variables in path:
Delete cache directory in flutter/bin
Then run flutter doctor
Make sure you downloaded the windows powershell i use windows 8 it wasn't installed by default , when i downloaded it it worked for me.
Check your flutter bin path in environment variable(User Variables). If not go to Under User variables check if there is an entry called Path:in that add this flutter/bin path.
Strangly when I kill the dart process in Windows Task Manager it is working. But sometimes even when dart process is running update working.
I had to turn off the Android Emulator. It was running for me...
I got the same error and was not able to get rid of it. So I deleted the flutter and instead of cloning it I downloaded the zip from the flutter website and extracted it. Now it works just fine.
Manually downloading the SDK from flutter website fixed the issue.
Still dont know why this problem occured tho.
If you are using Avast (or possibly some other anti virus too) on Mac and have recently updated the OS to Big Sur then follow the below steps to fix this issue
Open Avast and in the Web Shield area disable the "Scan secure connection".
Run flutter config --no-analytics and then run pub upgrade.
This should probably fix the issue.
You can also refer to below threads in Github for more details about the cause
https://github.com/flutter/flutter/issues/40515
https://github.com/flutter/flutter/issues/68999
In my case, the error resolve after adding below folder into exclude option in anti virus
Flutter SDK location
D:\Android\flutter_windows\flutter\*.
Flutter Local Pub folder
C:\Users\hitesh\AppData\Local\Pub
You get the error --
"Pub failed to delete entry because it was in use by another process.
This may be caused by a virus scanner or having a file
in the directory open in another application.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (1 tries left)" even if you are in one of the flutter directories from Windows explorer. Close the window and try running Flutter doctor. This will resolve.
If anyone faces this problem on macOS with AdGuard installed. Try this:
Go AdGuard Preferences -> Network -> Automatically filter applications -> Select Mode... and change mode to Automatic Proxy.
Pub failed to delete entry because it was in use by another process.
This may be caused by a virus scanner or having a file
in the directory open in another application.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
Tried switch to Dev channel and got stuck with "Unable to pub upgrade". Did everything and nothing worked.
This is what I did:
Renamed the Flutter SDK folder
Download the latest Flutter SDK
Extract to the same location of previous renamed SDK
Flutter channel Dev
Flutter upgrade
And everything back to normal.
Source of Problem
It might be possible that you don't have enough free disk space. That's what caused my problems to begin with.
Solution
In my case,
First I had to clean up space to remove any unused files.
Then I had to overwrite the flutter SDK folder due to corruption. The SDK can be found here.
I had the same issue with my MacBook M1. I tried deleting and running flutter pub cache repair But It didn't work for me.
Then I ran the command softwareupdate --install-rosetta and accepted the software licences & agreement (After installing XCode). Now the command flutter works fine. :)
Tried all of the above without success. The search order in the PATH system variable turned out to be the problem:
it was:
G:\My Drive\Compilers\flutter\bin;
G:\My Drive\Compilers\flutter\bin\flutter;
G:\My Drive\Compilers\flutter\bin\flutter.bat;
G:\My Drive\Compilers\flutter\bin\dart.exe;
G:\My Drive\Compilers\flutter\bin\dart;
G:\My Drive\Compilers\flutter\bin\dart.bat;
changed it to:
G:\My Drive\Compilers\flutter\bin\flutter
G:\My Drive\Compilers\flutter\bin\flutter.bat
G:\My Drive\Compilers\flutter\bin\dart
G:\My Drive\Compilers\flutter\bin\dart.bat
that fixed it
Mac auto iCloud upload might be causing the error
If you are using Mac and if your Desktop files are being uploaded to iCloud automatically, sometimes iCloud uploads the "bin" file or the "cache" file inside the flutter file. I've just downloaded the file onto desktop (right click the file -> "Download Now") and it downloaded the file, it ran as usual. (Automatic upload can be turned off from system preferences if youn are getting this error frequently like I was).
For my case, i was using ubuntu, and after reading the above comments, i have come to a resolution that the above error comes as a result of permissions being blocked, accessing cmd with admin access levels solves the problem, e.g on linux run sudo flutter doctor and the problem will be solved.
This error occured to me when i tried upgrading my flutter so it needed admin rights to be upgraded nothing much