- Flutter
- Requirements
- Flutter Setup
- Java Jdk
- gragle Setup
- Command line tools
- Creating Android Virtual Device
- Update the path for android SDK
- test Emulator
- Vs Code Setup
Flutter is Googleβs UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.
Operating System: Windows 7 or later, x86-64
Disk Space: 1.6 GB
Tools: Windows PowerShell, Git (Recommend)
You will need
- flutter sdk
- Git
- Visual Studio Code
- JDK 8
- gradle --not necessary(install to be on safe side)
- Command Line Tools
choose a directory
β οΈ Do not install Flutter in a directory like C:\Program Files\@ that requires elevated privileges
git clone https://github.com/flutter/flutter.git -b stable
Steps to add Flutter to the PATH environment variable:
- Open Edit environment variables for your account.
- Under User Variable double click Path
- Add flutter bin path in my case D:\Development\flutter\bin ok ok done
confirm by where flutter dart
command
from git bash or powershell run flutter doctor
PS D:\Development\flutter> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[β] Flutter (Channel stable, 2.0.4, on Microsoft Windows [Version 10.0.19042.906], locale en-US)
[X] Android toolchain - develop for Android devices
X Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup 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.
[β] Chrome - develop for the web
[!] Android Studio (not installed)
[β] VS Code (version 1.55.1)
I assume you have setup java home in system variable as JAVA_HOME and path to java/bin
From mobile apps to microservices, from small startups to big enterprises, Gradle helps teams build, automate and deliver better software, faster.
Write in Java, C++, Python or your language of choice. Package for deployment on any platform. Go monorepo or multi-repo. And rely on Gradle's unparalleled versatility to build it all.
Steps to setup gradle:
- Extract
gradle-7.0-bin.zip
zip file - Move the folder to the desire location in my case
D:\Development\
- Your directory will look like this:
D:\
βββ Development
β βββ gradle-7.0
β β βββ bin
β β βββ init.d
β β βββ lib
β β βββ LICENSES
β β βββ NOTICE
β β βββ README
β βββ android_sdk
β βββ flutter
Update the path:
- Open Environment Variables
-
Under System Variable Select New..., type
Variable name: GRADLE_HOME Variable value: D:\Development\gradle-7.0
-
Under System Variables select Path, then click Edit. Add an entry for D:\Development\gradle-7.0\bin. Click OK to save.
-
Verify your installation by
gradle -v
in the terminal
-
If you do not need Android Studio, you can download the basic Android command line tools. You can use the included sdkmanager to download other SDK packages.
-
Extract the
commandlinetools-win-6858069_latest.zip
- You will get
cmdline-tools
rename it totools
thats it - Now create another empty folder name it
cmdline-tools
& move the renamedtools
tocmdline-tools
- Move
cmdline-tools
to a desire directoryandroid_sdk
in my case: D:\Development\android_sdk* - Now the directory will look like
- You will get
D:\
βββ Development
β βββ android_sdk
β β βββ cmdline-tools
β β βββ tools
β β βββ bin
β β βββ lib
β β βββ NOTICE.txt
β β βββ source.properties
β β
β βββ flutter
- Go to android_sdk\cmdline-tools\tools\bin* you will see some of the bat file...
- Open cmd or powershell in that location by shift+click or by file option,..etc
To install the latest platform tools (which includes adb and fastboot) and the SDK, systemimages
in cmd
or shell
run the below command:
sdkmanager "platforms;android-29"
sdkmanager "build-tools;29.0.3"
Accept the sdk licenses by y
sdkmanager --list
select any system-images you like and install it using the command:
sdkmanager "system-images;android-29;default;x86_64"
Accept the licenses by sdkmanager --licenses
πkey-points to remember
-n
: name of the virtual device.
-k
: image to use, installed above step.
-d
: device id for hardware profile.
To check device id type avdmanager.bat list
in the same directory android_sdk\cmdline-tools\tools\bin (in the same directory because we still didn't set the bin path to environment variabale yet....)
Create AVD by the command:
avdmanager create avd -n Pixel -k 'system-images;android-29;default;x86_64' -d 17
DONE...
- Your directory will look like:
D:\
βββ Development
β βββ android_sdk
β β βββ .temp
β β βββ build-tools
β β βββ cmdline-tools (this was the first file with tools/bin inside)
β β βββ emulator
β β βββ extras
β β βββ licenses
β β βββ patcher
β β βββ platforms
β β βββ platform-tools
β β βββ sources
β β βββ system-images
β β βββ tools
β β βββ .knowPackages
β β
β βββ flutter
DOCUMENTATION According to google officials
ANDROID_HOME, which also points to the SDK installation directory, is deprecated.
If you continue to use it, the following rules apply:
- If ANDROID_HOME is defined and contains a valid SDK installation, its value is used instead of the value in ANDROID_SDK_ROOT.
- If ANDROID_HOME is not defined, the value in ANDROID_SDK_ROOT is used.
- If ANDROID_HOME is defined but does not exist or does not contain a valid SDK installation, the value in ANDROID_SDK_ROOT is used instead.
Environment variable :
-
Open Edit environment variables for your account.
- Under System Variable click New...
Variable name: ANDROID_HOME Variable value: D:\Development\android_sdk
- Again for sdk root
Variable name: ANDROID_SDK_ROOT Variable value: D:\Development\android_sdk
- Under System Variable click Path & add (Has to be the same order emulator, tools, platform-tools)
- %ANDROID_SDK_ROOT%\cmdline-tools\tools\bin
- %ANDROID_HOME%\emulator
- %ANDROID_HOME%\tools
- %ANDROID_HOME%\platform-tools
ALMOST DONE
list all the available AVD by the command emulator -list-avds
To run the emulator type emulator -avd avd_pame
or emulator @avd_name
replace avd_name with the name you gave during Create AVD step in this case Pixel
From cmd run flutter doctor -v
later flutter doctor --android-licenses
DONE....
- After installation of Vs Code install some the extension for code formating and intellisense
- Open Extensions tab manually or
Ctrl + Shift + x
install the extensions: they are- Dart (dart-code.dart-code)
- Flutter (dart-code.flutter)
- For More Developer feel :)
- Bracket Pair Colorizer
- Image Preview
- Flutter Widget Snippets
- Pubspec Assist
- Reload by
Ctrl + Shift + p
type reload clickReload Window
Creting flutter application in vs code there are two method:
-
Using Vs code GUI
- Open the Command Palette (Ctrl+Shift+P (Cmd+Shift+P on macOS)).
- Select the Flutter: New Application Project command and press Enter.
- Enter your desired Project name.
- Select a Project location.
- Then
Ctrl + Shift + p
type flutter launch emulator - flutter run form View -> command palette or
Ctrl + Shift + p
-
Using Vs code integrated termainl:
- Open termianl in vs code by Ctrl + Shift + ` (control, shift, backtick)
- Type
flutter create project_name
latercd project_name
- Start the emulator Emulator remember the command
- last
flutter run
In case you see the error message below when trying to accept licenses, This stack overflow helped.
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.