Install Flutter SDK on windows without Android Studio
To me Android Studio just a nightmare, as soon as I start it, and my PC start screaming endlessly, so I started a journey to find a way to install Flutter SDK without using or installing Android Studio, hence the following lesson come into existence.
All the commands in this tutorials are executed using windows command prompt, just run it from start menu, or hit <windows-key> + R
then type cmd
Create the working Dir
To keep everything in single place we will consider the dir C:\Android
as main working directory
cd C:\
mkdir Android
cd Android
Installing OpenJDK 8
Download Windows binaries from the following url:
https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u202-b08/OpenJDK8U-jdk_x64_windows_hotspot_8u202b08.zip
Other releases:
https://github.com/AdoptOpenJDK/openjdk8-binaries/releases
extract it and rename the internal folder “jdk8u202-b08” to “openjdk” and copy it under “C:\Android” folder, so its path will be:
C:\Android\openjdk
Installing Flutter SDK
Download flutter sdk latest version from following url:
https://flutter.io/docs/get-started/install/windows
extract it, and copy the folder with the name “flutter” to C:\Android folder, so the full path will be:
C:\Android\flutter
Installing Android command tools
Download Windows version of Android command tools from the following url:
https://developer.android.com/studio/#command-tools
extract it and rename the “tools” folder to “sdk”, then copy it under C:\Android folder, so the full path will be:
C:\Android\sdk
Set Some Environment variables
We need to define some environment variable which let the above tools know how to contact each other, form command prompt run these commands, one by one:
setx JAVA_HOME “C:\Android\openjdk”
setx ANDROID_HOME “C:\Android”
setx ANDROID_SDK_ROOT “C:\Android\sdk”
setx path “%path%;”C:\Android\sdk;C:\Android\sdk\bin;C:\Android\flutter\bin”
Download Android SDK
As you may already know the Flutter are based on Android SDK to work , so we need to download system images, platform tools, build tools, platforms, and emulator, by running the following commands:
sdkmanager “system-images;android-27;default;x86_64”
sdkmanager “platform-tools”
sdkmanager “build-tools;27.0.3”
sdkmanager “platforms;android-27”
sdkmanager emulator
Note1: the date I write this tutorials the latest version of the above images was 28, but I downloaded the previous one, so I can develop app for wider range of Android OS versions, you can run the command
sdkmanager --list
to see available images and choose whatever you want.Note2: Make sure to accept any license that appear by pressing
y
thenEnter
, or nothing will be downloaded.
Accept the licenses
Android sdk images have licenses that need to be accepted, you do that with the command:
sdkmanager — -licenses
just press y
then Enter
for for every license.
Configure Flutter
configure flutter to know the dir of Android sdk path
flutter config — -android-sdk C:\Android\
Create the Emulator
Create a new emulator with the name “nexus” or choose the name you want:
avdmanager -s create avd -n nexus -k “system-images;android-27;default;x86_64”
answer with [no] to the showed question.
Run the emulator
flutter emulators --launch nexus
Moment of truth
flutter doctor -v
This command should give all green and ok, ignore the Android Studio complain, since this lesson is all about ignoring it in the first place.
Test flutter code
cd C:\Android\flutter\examples\hello_world
flutter run
[Extra] Other Good Emulator commands
Run emulator using emulator
command, it should be executed from inside C:\Android\emulator
cd C:\Android\emulator
emulator -avd nexus
This command is good to see error messages
Create an emulator based on real device features
avdmanager -s create avd -n latest -k “system-images;android-27;default;x86_64” -d 30
you need to change the 30 with any other device id, you can see all available devices with the command:
avdmanager list device
Delete existed virtual emulator
avdmanager delete avd -n nexus
List all already created virtual emulators
avdmanager list avd
for more help
avdmanager help