Sometimes due the hardware constraints or some other reasons developer will prefer light weight solution rather than Big Bulky Android Studio. So heres a good news for you in this article we will configure visual studio code to work with flutter without android studio. We are using ubuntu 19.04 as operating system but you can choose choice of your linux distros. Though as a full time linux user I'm not including "How to perform same procedure on windows?". So lets get started....
We are installing it by following below steps respectively:
- Navigate to folder where you downloaded your binaries.
- Extract it and move it to relevant location.
- Set up path and refresh .profile file to access utilities.
To set up path open profile type in terminal
$ gedit ~/.profile
$ unzip sdk-tools-linux-4333796.zip $ mkdir Android $ mv tools/ Android/ $ sudo mv Android/ /usr/lib
#android home export ANDROID_HOME=/usr/lib/Android export PATH=$ANDROID_HOME/tools:$PATH export PATH=$ANDROID_HOME/tools/bin:$PATH export PATH=$ANDROID_HOME/platform-tools:$PATH #android sdk root export ANDROID_SDK_ROOT=/usr/lib/Android export PATH=$ANDROID_SDK_ROOT:$PATH
$ tar xvf flutter_linux_v1.9.1+hotfix.2-stable.tar.xz $ sudo mv flutter/ /usr/lib
#flutter export FLUTTER_HOME=/usr/lib/flutter export PATH=$FLUTTER_HOME/bin:$PATH
$ unzip gradle-5.6.2-bin.zip $ mkdir gradle $ mv gradle-5.6.2/ gradle/ $ sudo mv gradle/ opt/
#gradle export GRADLE_HOME=/opt/gradle/gradle-5.6.2 export PATH=GRADLE_HOME/bin:$PATH
- Open synaptic package manager if you don't have it install via
$ sudo apt install synaptic
- Type in OpenJDK 8 to search bar.
- Apply and wait for install. Don't worry it will set up environment variable for you automatically.
Our installation of packages is done use subsequent command to refresh .profile
$ . ~/.profile
For setting Android environment you have to downlaod following packages. I'm Downloading latest one as the date of publshing but you can download many system images to support wide array of devices using sdkmanager.
$ sdkmanager "system-images;android-29;google_apis;x86_64" $ sdkmanager "platforms;android-29" $ sdkamanger "platform-tools" $ sdkmanager "patcher;v4" $ sdkmanager "emulator" $ sdkmanager "build-tools;29.0.2"
Accept all licenses using
Update flutter config and set path to android sdk directory where it is installed.
$ flutter config --android-sdk /usr/lib/Android
You have to install flutter extension in visual studio code in order use flutter.
Create emulator with name pixel or choose the name you want
$ avdmanager -s create avd -n pixel -k "system-images;android-29;google_apis;x86_64"
Create emulator using existing devices features
$ avdmanager -s create avd -n pixel -k "system-images;android-29;google_apis;x86_64" -d 19
you can get list of exting devices using
$ avdmanager list
$ flutter doctor -v
This command should give all green and ok except android studio path.
$ flutter emulator --launch pixel