1

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.

4
  • Have you added path variable for your flutter sdk package? Commented Feb 1, 2019 at 14:02
  • i don't know how to do that ? Commented Feb 1, 2019 at 14:06
  • Look at this. I think it'll help you - flutter.io/docs/get-started/install/windows Commented Feb 1, 2019 at 14:10
  • Thank you very much, I got that. Commented Feb 1, 2019 at 14:27

3 Answers 3

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

I was facing this issue in Ubuntu 22.04, because by default sh shell was selected, when i changed to bash shell, it worked since my flutter was configured with bash shell. Thanks :)
0

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

0

I've just solved this for myself by completing the next steps:

  1. Click on "File" in Android Studio
  2. Choose "Settings..."
  3. Open the "Tools" branch
  4. Choose "Terminal" in the dropped down list
  5. In "Shell Path", change powershell.exe to

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.