Setup Flutter and Android Studio In macOS

205 阅读1分钟

Re: flutter.dev/docs/get-st…

Flutter

  1. Change terminal shell

If you are using a Mac computer with the macOS Catalina operating system, your installation requires a few extra steps.

  1. Check your macOS version: Go to the Apple icon at the top left, then select About This Mac. If the version is macOS Catalina then you should continue to the steps below. If it's lower than 10.15 e.g. 10.14 (Mojave) or 10.13 (High Sierra) then you are fine to go.

  2. Open up Terminal

  3. Change your Terminal shell to zsh If your terminal use Bash as default shell: Then you can remove the message by going to Terminal --> Preferences and changing the "Shells open with" to the "Command" radio button and change the text to /bin/zsh and hit enter.

  4. Confirm you are using zsh Close down Terminal and re-open it using Spotlight (see Step 2). Check the shell that is used in this new window by typing the following command into the Terminal and hit enter. echo $SHELL

The reason why we have to do this is because of licensing changes. You can read more about it here: Why does macOS Catalina use Zsh instead of Bash? Licensing thenextweb.com/dd/2019/06/…

  1. Download Flutter SDK from flutter.dev/docs/get-st…

  2. Unzip the SDK and move it to user->Developer

  3. Update your path Open terminal, enter

vim ~/.zshrc

Hit I to insert Enter

export PATH="$PATH:$HOME/Developer/flutter/bin"

Hit Esc Key and then Enter

:wq! 

and hit Enter key to exit

  1. Open a new terminal and use command flutter --version to check flutter and dart version and confirm if the installation is successful

  2. User command flutter doctor to check what packages are installed and what are not.

Android Studio

  1. Download the latest android studio from developer.android.com/studio

  2. Install the andorid studio and then install flutter and dart plugins

  3. Create a android emulator in tools / AVD Manager Choose Nexus 6 and pie as system image, select hardware for graphics rendering

  4. Now you can run your app in android studio with Nexus 6 emulator

IOS

  1. Install Xcode and launch the Xcode at least once after installation
  2. Open terminal and enter following command to configure xcode command line
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
  1. Exit the terminal and now you can run the iphone emulator in the android studio