Flutter Dev Environment Installation-by-hand Without AndroidStudio
Hi!. This is my second how-to in the series about these technologies. I have managed to install them side by side on Debian 10 (without ppa or deb, just sources) and make use of the newest of them.
NOTE: I use the Dart SDK that cames with Flutter, I think it’s just enough.
Let’s begin: I have created a master folder in my home dir -> ~/Dev, created this structure by hand:
- ~/Dev
|- sdk
|- flutter
|- FlutterProj
|- AngularProj
Modify your ~/.bashrc according to that structure (add this to the end or to ~/.profile end’s) :
export DEV_HOME=”$HOME/Dev”
export DART_HOME=”$DEV_HOME/flutter/bin/cache/dart-sdk/bin”
export FLUTTER_HOME=”$DEV_HOME/flutter/bin”
export ANDROID_HOME=”$DEV_HOME/sdk”
export ANDROID_NDK_HOME=”$ANDROID_HOME/ndk-bundle”
export PATH=$PATH:$ANDROID_HOME/tools/bin:$ANDROID_HOME/tools:$ANDROID_NDK_HOME:$DART_HOME:$FLUTTER_HOME:~/.pub-cache/bin
NOTE: I don’t know why, but if I use an export for PUB_CACHE and put it on PATH string, pub just keeps me asking for the binaries!!!, so I just write the pub-cache route directly on the PATH export.
Download pre-requisites:
# JDK 8 for Android SDK no longer supported in Debian 10. Use AZUL ZULU-8
$ sudo apt-key adv — keyserver hkp://keyserver.ubuntu.com:80 — recv-keys 0xB1998361219BD9C9
# FOR UBUNTU, uncomment this
# sudo apt-add-repository ‘deb http://repos.azulsystems.com/ubuntu stable main’
# FOR DEBIAN
$ sudo sh -c “echo ‘deb http://repos.azulsystems.com/debian stable main’ > /etc/apt/sources.list.d/zulu.list”$ sudo apt-get update
$ sudo apt-get install -y git curl unzip
$ sudo apt-get install -y lib32z1 lib32stdc++6 libc6-dev-i386
$ sudo apt-get install -y zulu-8
$ sudo apt-get install virt-manager qemu-kvm
$ sudo usermod -a -G kvm <yourusername> # ←Remember to use your sesion user here, not “root”
Now it’s up to you if you reboot your PC or just re-login your session. Now we install Android SDK
$ mkdir $DEV_HOME/sdk
$ cd $DEV_HOME/sdk
$ wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip # Change here the latest sdk version or let it autoupdate later!
$ unzip sdk-tools-linux-*.zip
$ rm sdk-tools-linux-*.zip
With the Android SDK in place, let’s download the required libs & tooling for our flutter dev env to function properly. This is a curated list of modules that Itested to be the minimal necessary:
$ sdkmanager “tools”
$ sdkmanager “patcher;v4”
$ sdkmanager “platform-tools”
$ sdkmanager “build-tools;28.0.3”
$ sdkmanager “platforms;android-28” # android-29
$ sdkmanager “system-images;android-28;google_apis_playstore;x86_64”
$ sdkmanager “cmake;3.10.2.4988404”
$ sdkmanager “emulator”
$ sdkmanager “lldb;3.1”
Let’s clone the flutter repository on ~/Dev and start flutter’s download process & tooling startup. Remember that you are on the STABLE track (No “Flutter for Web”, here!.. yet!):
$ git clone -b stable https://github.com/flutter/flutter.git $DEV_HOME/flutter
$ flutter
Now we acept the Android SDK licenses so we can create our first android emulator named “AVD01”, you can choose your own name!
$ flutter doctor — android-licenses
$ flutter emulators — create — name avd01
$ flutter emulators — launch avd01
And finally just to check everything is ok!
$ flutter doctor -v
The tooling is on place so we need to start coding. I use Visual Studio Code and installed the “Dart Code” & “Flutter” extensions. They’re great!.
For AngularDart, i installed stagehand & webdev from pub
$ pub global activate stagehand & pub global activate webdev
This installs a “stagehand” CMD to automate AngularDart apps creation & scaffolding. Change to your new app folder and type “pub get && pub upgrade”, then use “webdev serve”. Open VS Code, save some changes to the template and reload your webapp to see it changes instantly!.
For Flutter, the tooling is so powerful that it will allow you to
$ flutter create — org pe.com.my_org demo_app
to scaffold our “demo_app” registered in Java as demo_app.my_org.com.pe (in reverse). Just cd to the “demo_app” folder and open your editor to begin “flutter run” and see Hot-Reload in action.!.
I’ll try to mantain this guide as updated as possible, but i relay on your feedback. I’m very honored to be read. Thanks and great coding!
