I'm new in flutter and trying to learn about it for the first time.
I'm following the instruction of flutter documentation in here
When in step to the setting environment, I follow the instruction here.
After restarting the pc, the next step I must running the command flutter doctor in cmd.
In this step, I get stuck because in cmd, flutter doesn't response anything.
I try to execute flutter inside VSCode It still stuck with loading.
I also try to running with android studio, Still the same, I get stuck with loading
What should I do?
I missed the important thing.
Just don't put it in the privilege directory.
Related
I was trying to configure my Flutter project to work on the web. I switched to the master channel using flutter channel master after doing this I tried to run flutter upgrade. I am now getting an infinite loop saying:
Building flutter tool...
Running pub upgrade...
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)
Waiting for 0 seconds, press CTRL+C to quit ...
Running pub upgrade...
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... (8 tries left)
Waiting for 2 seconds, press CTRL+C to quit ...
Terminate batch job (Y/N)? Y
I have tried multiple things such as running flutter clean, trying to change back to the stable channel, deleting the cache folder in the flutter/bin directory, turning off my windows defender, nothing seems to work. Now when I try to run flutter doctor, or any other flutter command, I get the same infinite loop with the same message. I have also tried manually downloading and replacing my flutter sdk installation with a new installation, this did not work either. Is my only option at this point to delete flutter completely and reinstall from scratch?
I would appreciate any suggestions on how to fix this.
I ran my compiler as an administrator, and it worked for me.
Open your Android Studio or Visual Studio as an admin.
I was running into this issue and discovered that the problem was a new dependency that I added. In my case it was assets_audio_player: ^3.0.3+1, but of course it could be any dependency. Deleting it immediately fixed my problem.
Faced this problem and had to run "start ms-settings:developers" at terminal. It solved the issue.
On windows: Run vscode, or the terminal you are using, as admin to resolve the problem.
For Linux: I think some kind of sudo approach could do the trick.
run
flutter upgrade
in an external admin cmd console
use powershell (admin) to fix this I got same problem and fix this using Windows PowerShell (Admin). Just type flutter
switch your channel to stable or master using command "flutter channel stable"
I have solved it. I recommend instead of C:/src/flutter, you put the flutter folder inside C:/ direct. Would be like this:
C:/flutter
If that doesn't solve it, try pausing your anti-virus just for us to test. It could be that it is blocking the permissions on local disk C folder. It's not very common, but it can happen sometimes.
Running VS Code or Android Studio as Administrator, will probably solve the problem.
I'm new to learning flutter when I try to crate a new project on android studio gives me a arror message in the event section enter image description here
The MESSAGE: [Could not find an option named "platforms". Run 'flutter -h' (or 'flutter -h') for available flutter commands and options.]
And another problem is flutter doctor does not see the android studio enter image description here
1(By the way, I want to use this version of flutter, please do not give a suggestion like update.)
2(this problem did not exist before, it happened after turning my computer off and on)
And sorry for my english mistakes
Thank you.
flutter version flutter_windows_v1.12.13+hotfix.9-stable
andorid studio version: 4.1.3
Is this the answer to your question about andorid studio?
and you need to install JDK
You are using the wrong flutter SDK. Too low information in your question. Make sure that you have the right path to flutter SDK in your IDE. Check that the flutter SDK directory has the appropriate structure, all needed files and cetera. Channel and version of flutter also may have an influence on this problem.
Got this today out of nowhere. Things were going well, but suddenly when I tried to relaunch the app from fresh, for the error Could not find an option named "target"
UPDATE:
This appears to happen when I switch branches and merge while app is running/flutter is attached. If you're using VS Code,
open your launch.json
change something, I decided to change type: "dart" to type: "notdart"
save
try to debug which fails
then revert that change.
This should fix the issue.
Previous Answer/If you're not using VS Code
What worked for me was to
flutter clean
close the editor (VS Code for me)
close the emulator
give a minute for things to close down
open task manager and kill any left over processes of dart.exe flutter.exe and java.exe and adb.exe (was doing Android)
start VS Code/Android Studio and try to debug again. (when prompted I chose to cold boot the emulator as well)
This takes a while as the emulator has to cold boot and since flutter clean was run, the compilation hadto start from scratch as well.
I'm relatively new to Flutter but I already have developed and finished some Apps in Flutter.
Recently I noticed a weird behavior of commands with the keywords "dart" or "flutter" in it.
Here is an example:
I was trying to migrate an existing project to the new dart null-safety and typed the command dart migrate into my Visual-Studio-Code Terminal.
I was expecting an output like Migrating C:\.... as a response but instead got these three lines:
The command "git" is either misspelled or could not be found.
Building flutter tool...
Running pub upgrade...
and then the expected output:
Migrating C:\<project path>...
and so on.
So basically the commands work as they would normally do but I get these three lines before the output everytime. And it's not only with this command. Also basic commands like dart help or flutter doctor will get these three lines.
I don't know what I am doing wrong. I uninstalled Flutter and also removed it from the PATH and then reinstalled it freshly but it's still the same. I also searched the web but didn't found anyone who has the same problem.
Any help and explanation would be great. Thank you for your time :)
I think I know where the problem is. I ran the commands directly when I opened PowerShell. But the directory was something like C:\Windows\ and then it won't work.
After I did cd C:\Users\User all commands will work as expected.
I was just thinking that it doesn't matter from where I run dartand fluttercommands obviously you have to be in your user directory that they will work properly.
Whenever I use the command flutter clean or flutter run, the window "The Dart Analyzer has terminated." pops up in VS Code.
For flutter run I can specify that the analyzer terminates when it says "Running Gradle task 'assembleDebug'" in the console.
Here is the log after running flutter clean: https://hastebin.com/osovilenaj.swift
Can someone tell me the reason for this behaviour? I can simply click on restart, but it is annoying during my workflow.
Try to update and restart both PC and VSCode, see if the problem persist.
It generally used to happen to me when either my CPU is doing too much work or the RAM is exhausted, see if you have same problem either with CPU or RAM use a real device to test with USB Debugging enabled instead of Emulator.
also this might also help VSCode dart analyzer stopped recognizing flutter/dart code
Since something (Dart?) has been updated the error does not occurre anymore.
I am running flutter on my windows machine, it was working earlier and I have created demo project with it.
Today when I run VSCode it asked me to update flutter and I did, but when it is updated it is not able to run any command. It doesn't do anything, neither error nor success. It just get stucked with any flutter command.
Note : It was working earlier, so there is no chance of setting environment variables, still I have double checked it and it is there.
I did not find any solution for this so the last available approach for me was to reinstall flutter SDK and it worked.
Note: If you are windows user, you might get an error about PowerShell version, you must have PowerShell version greater than 5.1