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.
Related
All I wanted was to make a simple flutter/dart calculator in VS code... but I've been suffering tech issues for the last 2 days trying to get it working.
Right now my problem is basically VS code is unresponsive outside of the terminal I think.
Example: in terminal when I run 'flutter doctor -v' I get
running flutter doctor in terminal
As you can see everything works fine, but when I do ctrl+shift+p and run flutter doctor it never finishes loading in the bottom right, just stating 'flutter doctor -v: running...' same with when I run Flutter: New Project.
Also when I select the No Device in the bottom right of the VS code screen to choose an emulator to run it does the same thing, just loading for ever... I have no clue why. I followed about 10 youtube tutorials on how to set up VS code for flutter, after non of them worked I uninstalled and reinstalled VS code, Android Simulator, flutter, cleared settings and fresh installing each and this problem persists.
Please check you are on the latest version of VS Code and the Dart extension. This issue should've been resolved in the Dart extension version v3.38.0.
https://github.com/Dart-Code/Dart-Code/issues/3877
If you still see this in the latest version, please file an issue on GitHub for me to take a look.
I am new in android studio and flutter and I have encountered several problems after installing them. I already went to flutter doctor and it's all checked so flutter isn't the problem. I can't start coding because of these problems:
Here the sample code made by flutter itself I can't run it has several errors and
Here I can't run any virtual device because it says that I don't have an internet connection which is not true. I cannot code if I can't run the sample dummy code.
Thanks
I think you haven't properly done the setup for Android Studio. Please check the documentation where you will get steps for proper installation.
Few things which you can check:
Flutter and Dart plugins should be installed in Android Studio
If you want to run on an emulator, you will have to download the image for it whose answer you can find in previous answers.
When you first open Android Studio, you should get an option to create a Flutter Application.
Try to reinstall android studio with stable internet connection.
i would advise you to follow below steps to download system images to create virtual device
Select sdk manager
Download a system image by selecting show package details.You can download api32 system images which is the latest for now.
Once downloaded you can see the image file while created avd.
Some errors i got and how i fixed it
(ERROR 1) [flutter] flutter doctor -v 'crumb' is not recognized as an internal or external command, operable program or batch file. Error: Unable to find git in your PATH. exit code 1
(FIX) Go to flutter installation folder and inside flutter/bin edit the flutter.bat file using a text editor and remove the line (20) that says
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
The code should look like this on those lines
REM If available, add location of bundled mingit to PATH
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
Save and Run flutter doctor and everything should work fine.
(ERROR 2) flutter doctor takes too long
(fix) I downloaded the previous version of the sdk it worked like a charm
(ERROR 3) Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.
(fix) Open Android Studio
Tools Menu, SDK Manager
In the window that comes up there are inner panels, choose SDK Tools panel
Tick Android SDK Command-line Tools
Choose Apply button near the bottom of the window
This worked
(ERROR 4) `The term 'flutter' is not recognized as the name of a cmdlet, function, script file, or operable program.
(fix) put the correct part in the env variables like i had put D:\flutter insted of D:\flutter\bin that worked
When I try to start my main.dart I get an error called
"Exception: Gradle task assembleDebug failed with exit code 1".
I'm running the default code when you create a new project with flutter create "name". When I run flutter doctor I get no errors, so I don't know what could be the problem. Some people said not enough space on disk. But I have about 50gbs left. I'm running on the android emulator with the pixel 4. Yesterday everything worked fine and today I wanted to create a new project, and now it doesn't work anymore. Even though I didn't change anything in the emulator settings or the VS Code settings/file.
Any help is appreciated
I believe this is the problem where the default gradle is outdated and sucj you need to update it, if you are using android studio, when opening a gradle file in teh top right corner it will say open for editing in android studio , click on it and it will open a new window, in the terminal run gradlew or gradlew upgrade.
also the flutter team said they were working on it, so try to update flutter to the latest version using the command flutter upgrade
I am tried to solve this issue in VSCode, flutter. I tried all possible solutions, and it works for few days then again same thing happens.
here is what i tried:
1-
changed in gradle.properties the following line
org.gradle.jvmargs=-Xmx1536m
to
org.gradle.jvmargs=-Xmx1024m
and
org.gradle.jvmargs=-Xmx512m
2-
changed in gradle-wrapper.properties the following line
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
3-
delete the emulator and make the new one
4-
free some space
I have windows 10 in my pc and, 64-bit operating system. please let me know if anyone can resolve this issue.
The general steps I would use are:
run flutter doctor in terminal
if you are using an emulator make sure it has enough space (often it needs a restart to clear junk files created upon consecutive deploys)
if the gradle files have been modified it is recommended to open them with Android Studio (Android folder of the application). If anything is missing the IDE will prompt you to install the missing dependencies.
I'm working with some tutorials to learn Flutter and the one that I'm taking now uses VSCode. I actually prefer it to Android Studio because it doesn't overheat my Macbook. The only frustration I've had with it so far is that there are quite a few times where autocomplete just stops working. For instance, if I wrap a Column in a widget and then start typing Container, Android Studio will pop up an autocomplete showing Container VS Code used to do this for me, but has stopped for some reason. I can still get the autocomplete list if I press Ctrl+Spacebar.
I'm using the following:
VS Code - 1.36.1
Dart Extension - 3.2.0
Flutter Extension - 3.2.0
Material Icon Theme - 3.8.0
This is the latest version for all of these.
Is there some setting or something that I need to change? I've spent the last two hours trying to work out what's going on. In searching, I did see some references to earlier versions of VS Code and the extensions causing problems, but nothing about these versions.
Go to pubspec.yaml and hit save or run get packages. It worked for me, hope it helps
There are generally two reasons for VS Code to automatically open code completion - 1) when you press a key that the extension ahs told VS Code should invoke it and 2) when VS Code thinks it would be useful (for example when you start typing on a blank line). If you're typing in a line of existing code it won't always do this.
Pressing Ctrl+Space is the correct way to open completion in the cases where it doesn't appear automatically.
That said, if you can provide more information about a specific instance, I can take a look if it's something we could/should pop completion open for. It would be best raised at https://github.com/Dart-Code/Dart-Code/issues with a screenshot and details of exactly where your cursor is (and how you got there).
dont use too many flutter extension, I also face this problem , then I realize that 3 flutter extension are installed, use only one , it works for me, try it.
I did have a derivative of this problem when I was working with VS Code and flutter and this is what I did.
This is for windows though. This is what I did ;
Go to C:\Users<your username >\AppData\Roaming\Code and delete all the files and the directory called "Code". Usually the folder AppData is hidden so you'll have to unhide it. Then restart your computer and then reopen VS Code. This I think cleared some of the unwanted cache files which kind of made things right again.
Hope it helped.
Make sure
Preferences > Editor > Intentions > Quick assist powered by the Dart
Analysis Server
is enabled (Screenshot).
If so, most likely your Dart Analysis server is crashing. Navigate to your HOME folder:
cd ~
And then below should resolve your issue:
sudo chown -R $USER .dart .flutter
Clear your cache if the issue still exists:
File > Invalidate Caches > Clear file system cache and Local History > Invalidate and Restart.
Also, Power Save Mode should be disabled:
File > Power Save Mode
Doing a flutter clean and then flutter pub upgrade worked for me. Sometimes flutter clean using the command line does not work if you have android studio then in tools go to flutter and then do flutter clean.
just do flutter clean then flutter create. and then flutter pub upgrade, and also see if your flutter SDK is latest or not.
Check to make sure Android Studio is not on low power mode
Menu>File>Low Power Save Mode
I solved in in my Macbook Pro by
Going to System Preferences > Keyboard > Shortcuts > Input Sources
Disable: Select the previous input source (^ space)
Updating VS Code dart and flutter extensions
Restarting the computer.
And voila! Ctrl + space now shows options in VS Code.