Guide to Open and Run an Existing Flutter App in Android Studio
Article Description:
This comprehensive guide walks you through the complete process of setting up and running an existing Flutter application in Android Studio. Perfect for developers new to Flutter or those troubleshooting setup issues, this step-by-step tutorial covers everything from installing Flutter SDK and Android Studio to running your app on both emulators and physical devices. Learn how to properly configure development environments across Windows, macOS, and Linux, install necessary plugins, set up Android SDK components, and resolve common issues that might arise during the process. Whether you're joining an existing project or picking up Flutter development after a break, this guide ensures you'll have your development environment ready in no time.
Table of Contents
- Installing Flutter SDK
- Installing Android Studio
- Installing Flutter and Dart Plugins
- Setting Up Android SDK
- Opening an Existing Flutter Project
- Installing Project Dependencies
- Running the Flutter App
- Troubleshooting Common Issues
Installing Flutter SDK
Windows
- Download the Flutter SDK from the official Flutter website
- Extract the zip file to a desired location (e.g.,
C:\src\flutter
). Avoid paths with spaces or special characters. - Update your PATH environment variable:
- Right-click on "This PC" or "My Computer" and select "Properties"
- Click on "Advanced system settings"
- Click "Environment Variables"
- Under "System variables", find the "Path" variable, select it and click "Edit"
- Click "New" and add the path to
flutter\bin
directory (e.g.,C:\src\flutter\bin
) - Click "OK" to save the changes
macOS
- Download the Flutter SDK from the official Flutter website
- Extract the file to a desired location:
cd ~/development unzip ~/Downloads/flutter_macos_3.13.0-stable.zip
- Add Flutter to your PATH:
export PATH="$PATH:`pwd`/flutter/bin"
- To update PATH permanently, edit your shell's config file (
.bash_profile
,.zshrc
, etc.):echo 'export PATH="$PATH:~/development/flutter/bin"' >> ~/.zshrc
Linux
- Download the Flutter SDK from the official Flutter website
- Extract the file:
cd ~/development tar xf ~/Downloads/flutter_linux_3.13.0-stable.tar.xz
- Add Flutter to your PATH:
export PATH="$PATH:`pwd`/flutter/bin"
- To update PATH permanently, edit your shell's config file:
echo 'export PATH="$PATH:~/development/flutter/bin"' >> ~/.bashrc
Verify Installation
In any terminal or command prompt, run:
flutter --version
You should see the Flutter version information. Then run the Flutter doctor command to check if there are any dependencies you need to install:
flutter doctor
Installing Android Studio
Windows
- Download Android Studio from the official website
- Run the installer and follow the installation wizard
- Select "Standard" installation which includes:
- Android SDK
- Android SDK Platform
- Android Virtual Device
- Complete the installation process
macOS
- Download Android Studio from the official website
- Open the downloaded .dmg file
- Drag Android Studio to the Applications folder
- Launch Android Studio and follow the setup wizard
- Select "Standard" installation
Linux
- Download Android Studio from the official website
- Extract the downloaded file:
sudo tar -xzf android-studio-*.tar.gz -C /opt/
- Launch Android Studio:
cd /opt/android-studio/bin ./studio.sh
- Follow the setup wizard and select "Standard" installation
Installing Flutter and Dart Plugins
- Launch Android Studio
- Go to File > Settings (on Windows/Linux) or Android Studio > Preferences (on macOS)
- Navigate to Plugins
- Click on the Marketplace tab
- Search for "Flutter" plugin and click Install
- The Dart plugin will be installed automatically with Flutter
- Restart Android Studio when prompted
Setting Up Android SDK
- In Android Studio, go to File > Settings (Windows/Linux) or Android Studio > Preferences (macOS)
- Navigate to Appearance & Behavior > System Settings > Android SDK
- In the SDK Platforms tab, select Android versions you want to support (at least Android 11.0 R, API Level 30 is recommended)
- In the SDK Tools tab, make sure the following are installed:
- Android SDK Build-Tools
- Android SDK Command-line Tools
- Android Emulator
- Android SDK Platform-Tools
- Click "Apply" to download and install the selected components
Configure Android Licenses
Run the following command to accept all Android licenses:
flutter doctor --android-licenses
Follow the prompts and accept all licenses.
Opening an Existing Flutter Project
- Launch Android Studio
- Select "Open an existing project" (or File > Open from the menu)
- Navigate to the directory containing your Flutter project
- Select the project's root folder and click "OK"
- Wait for Android Studio to index the project files and detect it as a Flutter project
Installing Project Dependencies
- Once the project is open, look for the
pubspec.yaml
file in the Project view - Open the file and look for any dependencies that the project requires
- In Android Studio's terminal (View > Tool Windows > Terminal), run:
This will download all dependencies specified in theflutter pub get
pubspec.yaml
file - Alternatively, in Android Studio, you can click on "Pub get" in the notification bar that appears at the top of the editor when viewing the
pubspec.yaml
file
Running the Flutter App
Creating and Managing Emulators
- In Android Studio, go to Tools > Device Manager
- Click on "Create Device" button
- Select a device definition (e.g., Pixel 5)
- Select a system image (Android version) and download it if necessary
- Provide a name for the AVD (Android Virtual Device) and click "Finish"
Running on an Emulator
- Make sure you have an AVD set up (as described above)
- In the main toolbar, select your emulator from the device dropdown
- Click the Run button (green triangle) or press Shift+F10
- Android Studio will build the app and launch it on the selected emulator
Running on a Physical Device
- Enable USB debugging on your Android device:
- Go to Settings > About Phone
- Tap "Build Number" seven times to enable Developer Options
- Go back to Settings > System > Developer Options (or Settings > Developer Options)
- Enable "USB debugging"
- Connect your device to your computer via USB
- Accept the debugging authorization prompt on your device
- In Android Studio, select your device from the device dropdown
- Click the Run button (green triangle) or press Shift+F10
Troubleshooting Common Issues
Flutter Doctor Issues
If flutter doctor
shows issues, follow the recommended steps to resolve them:
- For missing components, install them as directed
- For Android license issues, run
flutter doctor --android-licenses
- For Android Studio detection issues, ensure the Flutter plugin is properly installed
Gradle Build Issues
If you encounter Gradle build errors:
- Check your project's
build.gradle
files for compatibility issues - Run
flutter clean
in the terminal - Try rebuilding with
flutter run
Dependency Conflicts
If you have dependency conflicts:
- Check the
pubspec.yaml
file for version constraints - Try running
flutter pub outdated
to check for outdated packages - Update dependencies one by one and test after each update
Device Connection Issues
If your physical device is not detected:
- Ensure USB debugging is enabled on your device
- Try a different USB cable or USB port
- Reinstall USB drivers for your device
- On Windows, check Device Manager for any issues with ADB interface
Flutter SDK Path Issues
If Android Studio cannot find the Flutter SDK:
- Go to File > Settings > Languages & Frameworks > Flutter
- Set the Flutter SDK path to the directory where you installed Flutter
- Click "Apply" and "OK"
Emulator Performance Issues
If the emulator is slow:
- Enable hardware acceleration in BIOS (Intel VT-x or AMD-V)
- Use a system image with Google APIs but without Google Play
- Allocate more RAM to the emulator in AVD settings
- On Windows, ensure Hyper-V is enabled for better performance