Tested/Updated on: 27 May 2023 (02.12 AM)
Create a folder to Store all Flutter related stuff. We will refer to this folder as FlutterFolder
here on out.
mkdir Flutter
cd Flutter
Download and extract the latest version of flutter from their releases page (windows), or clone the stable branch with git FlutterFolder
:
git clone https://github.com/flutter/flutter.git -b stable
Add FlutterFolder\bin
to PATH
Create a folder to Store all Android related stuff. We will refer to this folder as AndroidFolder
here on out.
mkdir Android
cd Android
You can use any version JDK but make sure you check the licensing first
- GraalVM Community Edition (prefered)
- Oracle JDK (preferably not this)
- Microsoft build of OpenJDK
- OpenJDK 17
- Adoptium build of OpenJDK
JAVA 17 is prefered.
Download and extract Android Command Line Tools to AndroidFolder
, create a new folder latest
and move the folder contents into it. You should now have a folder structure as follows:
tree
└───cmdline-tools
└───latest
├───bin
└───lib
-
Create and set
JAVA_HOME
to your JAVA install folder (if you installed JAVA into sayD:\JDK17
addD:\JDK17
and notD:\JDK17\bin
) -
Create and set
ANDROID_SDK_ROOT
toAndroidFolder
-
Add
AndroidFolder\cmdline-tools\latest\bin
,AndroidFolder\emulator
,AndroidFolder\platform-tools
to thePath
(don't worry, these folders will be created later on)
READ NOTES BELOW FIRST
sdkmanager --install "platform-tools" "build-tools;33.0.2" "emulator" "system-images;android-29;google_apis_playstore;x86_64" "platforms;android-29"
-
sdkmanager can be found in
AndroidFolder\cmdline-tools\latest\bin
-
Always get the latest version of
build-tools
(list of all packages can be found by runningsdkmanager --list
-
I have installed Android-29 (Android Q), you can decide which version to install based on the cumulative usage as given on APILevels .
-
The system image you install should be of the same API level as your android platform, have
google_apis
if you want to use google APIs in your app orgoogle_apis_playstore
if you need google APIs and access to playstore/playstore-apps.x86
is for 32-bit operating systems,x86_64
is for 64-bit operating systems.
emulator -accel-check
If the output shows "installed and usable" your good to go. Else, install/re-install the Hypervisor with
sdkmanager --install "extras;google;Android_Emulator_Hypervisor_Driver"
Also install the required
-
AMD GVM: Download, extract and run
silent_install.bat
from github (GVM). -
Intel HAXM: Download, extract and run
silent_install.bat
from github (HAXM).
sdkmanager --licenses
Hit y
and Enter
for every license.
Download and install Visual Studio Build Tools (ideal)/Visual Studio Community Edition with the Desktop development with C++
workload, the following components must be included:
-
MSVC C++ x64/x86 build tools
-
C++ CMake tools for Windows
-
Windows 10 SDK
-
ATL Build tools (for flutter firebase)
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
wsl --update
Hyper-V (that is required for WSL2) is an Enterprise Edition feature, so, if your edition of Windows doesn't come with Hyper-V, you can enable it by running the following bat script:
pushd "%~dp0" dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i" del hyper-v.txt Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL pause
If you don't mind Ubuntu and it's virtual drive (which will only get bigger all the time) getting installed in some obscure corner of your disk,
wsl --list -o
wsl --install -d [distribution name]
If you care about where it is installed:
-
Make a directory to install Your Linux Distribution (we shall call this
LinuxFolder
) -
Download the relevant
.appx
/.appxbundle
file from this microsoft docs list and put it into yourLinuxFolder
. -
Rename your downloaded file to
.zip
, then extract it and run the.exe
that you find.
Create a folder to Store all Flutter related stuff. We will refer to this folder as LinuxFlutterFolder
here on out.
cd ~
mkdir Flutter
cd Flutter
For some reason WSL boots into Windows'
C:\
drive insted of your linux distributions user-root folder. That is why you absolutey must mot miss the firstcd ~
command — you'll end up installing all of this on windows instead of linux without that initial command.You can make it easier to follow/understand the folder structure by physically looking at it by running
explorer.exe .
after entering the user-root folder (which is denoted as~
on lixux.)
Download and extract the latest version of flutter from their releases page (linux), or alternatively run the following in your LinuxFlutterFolder
:
git clone https://github.com/flutter/flutter.git -b stable
You could also copy your windows Flutter files (make sure to copy the .git
folder too), drop the least 3-5 commits and then run git pull
to save data.
sudo apt-get update
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev unzip
Add FlutterFolder\bin
to PATH
by adding PATH=~/Flutter/bin:$PATH
to .bashrc
(it is imperateve that the linux path be prepended else the windows installation of FLutter will take precedence.)
How to edit
.bashrc
:cd ~ code .bashrc
Run the following on both Windows AND Linux:
flutter doctor --verbose
This command should give all green and ok, ignore the Android Studio complaint, since this gist is all about ignoring it in the first place.