i want to make apk of my flutter app. So I need to write "flutter build apk" command in terminal. but my terminal is not running any command. I am using Android Studio on Windows.
-
Have you added path variable for your flutter sdk package?Artem Botnev– Artem Botnev2019-02-01 14:02:20 +00:00Commented Feb 1, 2019 at 14:02
-
i don't know how to do that ?Rizwan Ansar– Rizwan Ansar2019-02-01 14:06:16 +00:00Commented Feb 1, 2019 at 14:06
-
Look at this. I think it'll help you - flutter.io/docs/get-started/install/windowsArtem Botnev– Artem Botnev2019-02-01 14:10:08 +00:00Commented Feb 1, 2019 at 14:10
-
Thank you very much, I got that.Rizwan Ansar– Rizwan Ansar2019-02-01 14:27:29 +00:00Commented Feb 1, 2019 at 14:27
3 Answers
Yes, this issue is probably because the environment path variable is not set in your android studio. Yes, you will have to set it manually in the terminal settings. In you Android studio: 1. Go to Settings 2. click on tools 3. Click on terminal 4.Now if your environment variable block is empty, click on right most part of the bar and copy paste the path(...\flutter\bin) and save it. 5. Now, restart your IDE. 6. Open terminal in Android studio and enter flutter run..
it will surely work
1 Comment
I have another solution which might work. I struggled myself until i saw a solution in a tutorial video. Search for "env" in the Windows 10 search box, select "edit environment variables for your account". Find or create the variable "Path" under "User variables for [USERNAME]" Add a new entry to your flutter/bin directory and restart android studio. Run the doctor, or another command, to check if it works :-)
Should work now in (almost) every terminal besides!
Comments
I've just solved this for myself by completing the next steps:
- Click on "File" in Android Studio
- Choose "Settings..."
- Open the "Tools" branch
- Choose "Terminal" in the dropped down list
- In "Shell Path", change powershell.exe to
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
- Click on "Apply"
In case you still have problems, make sure that "Include system environment variables" is enabled in the right most part of the "Environment variables" bar.
If nothing helped above, then you must make sure that you have "Path" environment variable for Flutter SDK (it has to end with .../flutter/bin).
Please, notice, that PowerShell.exe location may vary between the Windows versions! Find the powershell.exe file manually in your Windows folder.
Further troubleshooting
In case your PowerShell recognizes the flutter commands when launched outside of Android Studio, but not in the local terminal inside the IDE, then make sure that you have
Path=C:\ your\path\to\flutter sdk \flutter\bin
set in your "Environment variables" in the "Terminal" tab of Android Studio settings.