Flutter setup without android studio
Table of content
- 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
- 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
Update your Path
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
where flutter dart command
from git bash or powershell run
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:
- Move the folder to the desire location in my case
- 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 -vin the terminal
Command line tools
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.
- You will get
cmdline-toolsrename it to
- Now create another empty folder name it
cmdline-tools& move the renamed
cmdline-toolsto a desire directory
android_sdkin 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
shell run the below command:
Accept the sdk licenses by
List all the system-images and packages
select any system-images you like and install it using the command:
Accept the licenses by
Creating Android Virtual Device (AVD)
-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
- 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
Update the path for android SDK
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)
list all the available AVD by the command
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
This is it
From cmd run
flutter doctor -v later
flutter doctor --android-licenses
Visual Studio Code for Flutter
- After installation of Vs Code install some the extension for code formating and intellisense
- Open Extensions tab manually or
Ctrl + Shift + xinstall 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 + ptype reload click
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.
Ctrl + Shift + ptype 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)
flutter create project_namelater
- Start the emulator Emulator remember the command