Zainul
Posted on April 15, 2021
I've been through the pain of installing flutter recently. Theres almost no resources online that is up-to-date.
This is article would get you started with Flutter 2.0 right away.
Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Pick one. I personally use VS code.
brew install --cask android-studio
OR
brew install --cask visual-studio-code
Use Homebrew to install asdf, Android SDK, haxm and JDK8.
brew install asdf
brew install android-sdk
brew install intel-haxm
brew install --cask homebrew/cask-versions/adoptopenjdk8
Add the plugin for dart, flutter and ruby to asdf.
asdf plugin-add dart https://github.com/patoconnor43/asdf-dart.git
asdf plugin-add flutter
asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git
Now you can install dart, flutter and ruby with asdf.
asdf install dart latest
asdf install flutter latest
asdf install ruby latest
Take note of the installed versions by running this:
asdf list dart
asdf list flutter
asdf list ruby
Run the following in order to set the global runtimes.
NOTE: Please replace my version with your results from the previous part.
asdf global dart 2.12.4
asdf global flutter 2.0.4-stable
asdf global ruby 3.0.1
Lets put everything together and set things up.
Open up your bash or zsh rc file
vim $HOME/.zshrc
Add the following into your rc file in order to allow your system to run the flutter command so it is able to locate your Android SDK.
NOTE: replace 'zainulcain' with your own username
export PATH="$PATH:/Users/zainulcain/.asdf/installs/flutter/2.0.4-stable/bin"
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
press [esc], save and exit your rc file by typing ':wq'
Next you'll need to set up cocoapods.
sudo gem install cocoapods
pod setup
Lets accept the iOS and Android Licenses
iOS License
sudo xcodebuild -license
Android License
touch ~/.android/repositories.cfg
flutter doctor --android-licenses
sdkmanager --update
sdkmanager "platform-tools" "platforms;android-29” "build-tools;28.0.3"
flutter config --android-sdk /usr/local/share/android-sdk
Congratulations ! If you've done everything correctly, you can run this to confirm that everything is in working order.
flutter doctor -v
If you've enjoyed this, do give me a follow for more interesting articles :)
Posted on April 15, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.