简体   繁体   中英

How to give Flutter SDK Path in Android Studio on Mac os, How to update Flutter SDK path in MACOS?

I have installed the Android studio and the plugin's DART,FLUTTER to kickstart the flutter but as i am not able to give path of sdk while creating my very first project for flutter.

I tried to find out the solution did not got solution.. Finally this are the steps i have implemented and works for me. Prerequisites :-

  1. Install Android studio

  2. Install plugins to kick start flutter projects (DART,FLUTTER)

You can find out this inside android studio --> preferences --> Plugins

Now you have to setup Flutter SDK path to your Android studio

  1. Download the Flutter SDK

  2. Extract it where do you want (for example - /Users/vrushali/Downloads/flutter )

  3. Open your Android studio --> start a new Flutter Project --> select default application --> next --> select flutter sdk path --> browse to the . location where you have download and extract your flutter sdk --> select the flutter --> bin --> and say okay All set..! Your project will get created in some time :)

Theres a better way if you want to skip

Open your Android studio --> start a new Flutter Project --> select default application --> next --> select flutter sdk path --> browse to the . location where you have download and extract your flutter sdk --> select the flutter --> bin

doing every time you open android project

Step1:

open ~/.bash_profile

Step2 paste

PATH="/Users/vrushali/Downloads/flutter/bin:${PATH}"
export PATH

This will add the path permanently

asdf

If you have used asdf to install Flutter SDK .

You can find the location of the flutter by using the following commands,

  1. Open the location of asdf in terminal

    open ~/.asdf
  2. Inside the .asdf folder go to installs folder and then to flutter folder. Inside the flutter folder will find the current version of the Flutter SDK as the folder name.

    For example, in my case the folder name is 1.12.13+hotfix.7-stable and the path to the folder is /Users/akarshseggemu/.asdf/installs/flutter/1.12.13+hotfix.7-stable

For update flutter SDK path in Mac,

1. First your default shell using echo $SHELL command in Terminal.
2. Use below commane to open vim editor and update Path.
    - if it is Bash then type vim $HOME/.bash_profile or vim $HOME/.bashrc 
    - if Z shell then type vim $HOME/.zshrc
3. Type i to enter INSERT mode (or esc to exit INSERT mode).
4. Type export PATH="$PATH:[YOUR_PATH]/flutter/bin" replacing [YOUR_PATH] with the path to the folder where you moved the flutter folder earlier ex. export PATH="$PATH:/Users/Your_User/Your_Dev_Folder/flutter/bin"
5. Type esc, then :wq! to save and exit.
6. Quit the Terminal and open it again to refresh.
7. Type echo $PATH to check that the path was correctly added.       
8. Type which flutter to verify the flutter command is available.       
9. Type flutter --version to check the Flutter version.

This worked for me (for ZSH users)

Open terminal & run this command

touch $HOME/.zshrc

Run this command

sudo nano ~/.zshrc

Type the path like this

export PATH=$PATH:/Path to your extracted flutter/Flutter/bin

Press ctrl+x then press y Press Enter Close the terminal and open a new terminal and run this command

flutter --version

I asked the people that made the flutter plugin and they helped me out. For making flutter work with your IDE (haven't done this in Android but have in VScodium or Vscode).

In command line: asdf where flutter

In a text document:

export FLUTTER_ROOT="$/asdf/where/flutter/answer/should/go/here"

Add that to your bash_profile above the asdf part. Or your asdf installation won't work. With nano: ctrl+o, enter, ctrl+x.

Give your IDE the path to the installation, it should work. If not, the change needs to take effect, restart your computer.

只需提供保存 flutter 软件的位置即可。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM