When developing with Flutter™, you typically install Android Studio™ as part of the setup process. However, if you want a lightweight alternative, you can install Flutter™ with only the Android command-line tools. This guide walks you through the steps to set up Flutter™ on Windows without Android Studio™.
Step 1: Install Android Command-Line Tools
- Download Command-Line Tools:
Download the Android SDK Command-Line Tools from the Android Developer website.
- Extract the downloaded zip file:
Extract it to a directory, e.g.,
C:\Users\<User Name>\AppData\Local\Android\Sdk\cmdline-tools
. - Set up SDK directories:
- Inside the
cmdline-tools
folder, create a subfolder namedlatest
. - Move the extracted files and folders into this
latest
folder. The structure should look like:
C:\Users\<User Name>\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
- Inside the
Step 2: Install Required SDK Components
- Using the command-line tool:
Open a Command Prompt and navigate to the
cmdline-tools\latest\bin
directory:C:\Users\<User Name>\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
- Accept the SDK license agreements:
sdkmanager --licenses
- Install the required components:
sdkmanager "platform-tools" "build-tools;34.0.0" "platforms;android-35"
Step 3: Set Environment Variables
- Open the Environment Variables settings:
- Press
Win + R
, typesysdm.cpl
, and hit Enter. - Go to the Advanced tab and click Environment Variables.
- Press
- Add or update the following variables:
ANDROID_HOME:
Path: C:\Users\<User Name>\AppData\Local\Android\Sdk
- Update the
Path
variable to include:
%ANDROID_HOME%\cmdline-tools\latest\bin %ANDROID_HOME%\platform-tools
- Verify the setup:
adb --version
Step 4: Configure Flutter™
- Download and install the latest Flutter™ SDK:
Extract the zip file to a directory, e.g.,
C:\src\flutter
. - Set environment variables:
- Press
Win + R
, typesysdm.cpl
, and hit Enter. - Go to the Advanced tab and click Environment Variables.
- Add
FLUTTER_HOME
with valueC:\src\flutter
. - Update the
Path
variable to include:
%FLUTTER_HOME%\bin
- Press
- Verify the Flutter™ installation:
flutter doctor -v
- Resolve issues if any:
If any issues are listed under the Android toolchain section, ensure the
ANDROID_HOME
path and tools are correctly configured.
No comments:
Post a Comment