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 :)
Top comments (5)
I'm getting this issue:
Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
developer.android.com/studio/index...
On first launch it will assist you in installing the Android SDK
components.
(or visit flutter.dev/docs/get-started/insta...
for detailed instructions).
If the Android SDK has been installed to a custom location, please use
flutter config --android-sdk
to update to that location.Any ideas? And thanks in advance! Everything else went great and I've been trying to figure this out forever so already this has been super helpful!
flutter config --android-sdk /Users/$USER/Library/Android/sdk
Wow. Just great!!! Thanks very much. Helped me a lot.
Glad it helped :)
wow, that's awesome! I really like it! if you are interested in this topic, then check this article - dev.to/pablonax/free-flutter-templ...