This guide will walk you through the steps to install Flutter, set up Android Studio, download API 33 Android emulator, configure the Flutter toolchain, and run a Flutter application. Additionally, it includes instructions to build an Android APK.
Before starting, ensure you have the following:
- A computer running macOS, Windows, or Linux.
- Administrator access to install software.
- At least 2GB of free disk space.
-
Download Flutter SDK:
- Visit the Flutter Download Page.
- Choose the appropriate version for your operating system.
-
Extract Flutter:
- Extract the downloaded zip file to a location of your choice (e.g.,
C:\src\flutter
for Windows).
- Extract the downloaded zip file to a location of your choice (e.g.,
-
Add Flutter to PATH:
- Update your system's environment variables:
- On Windows: Add
flutter/bin
to the PATH variable. - On macOS/Linux: Add the following line to your
.bashrc
or.zshrc
file: bash export PATH="$PATH:[PATH_TO_FLUTTER_DIRECTORY]/flutter/bin"
- On Windows: Add
- Update your system's environment variables:
-
Verify Installation:
-
Run the following command in a terminal: bash flutter doctor
-
This will display a summary of your Flutter installation and indicate any missing dependencies.
-
-
Download and Install:
- Download Android Studio from the official website.
- Follow the installation instructions for your operating system.
-
Set Up Android SDK:
- Install Flutter plugin in andriod studio.
- Open Android Studio and go to File > Settings > Appearance & Behavior > System Settings > Android SDK.
- Ensure that the following components are installed:
- Android SDK Platform-Tools
- Android SDK Build-Tools
- API 33 (Android 13)
-
Create an Android Emulator:
- Go to Tools > Device Manager and create a new virtual device.
- Select a hardware profile (e.g., Pixel 8).
- Choose API 33 as the system image.
- Finish the setup and launch the emulator.
-
Run the following command to accept the Android licenses:
flutter doctor --android-licenses
-
Verify the Flutter setup:
flutter doctor
- Ensure there are no errors, and all checks are marked as
✓
.
- Ensure there are no errors, and all checks are marked as
-
Create a New Flutter Project:
- Run the following command:
flutter pub get
- Run the following command:
-
Make sure you have emulator running or andriod devie connected via USB to PC (which should have USB debugging enabled)
- To see emulators
To Launch an emulator
flutter emulators
flutter emulators --launch <emulator-id>
- To see available devices
flutter devices
- To see emulators
-
Run the App:
- Launch your Android emulator.
- Run the following command to start the app:
flutter run
-
Prepare everything for good FitZee app release.
-
Generate the APK:
-
Run the following command to build the release APK:
flutter build apk --release
-
The APK will be located at
build/app/outputs/flutter-apk/app-release.apk
.
-
-
Install APK on Device:
- Transfer the APK to your Android device and install it.
-
Flutter Not Recognized:
- Ensure Flutter is added to your system PATH correctly.
-
Emulator Not Detected:
- Verify the emulator is running and that Android Studio SDK paths are configured.
-
Build Fails:
- Run the following command to clean the build directory:
flutter clean
- Then rebuild:
flutter build apk --release
- Run the following command to clean the build directory: