Table of Contents
Android Studio and Emulator
This tutorial guides you through installing Android Studio and setting up the Android emulator for testing .NET MAUI applications. Android Studio provides a graphical interface for managing the Android SDK, emulator, and Android Virtual Devices (AVDs).
Alternative Approach
If you prefer a command-line approach without installing Android Studio, see the Development Environment Setup tutorial which covers setting up the Android SDK tools manually within a containerised development environment.
1. Download and Install Android Studio
Android Studio is the official IDE for Android development and includes all the tools needed to run the Android emulator.
- Download Android Studio from the official website
- Run the downloaded
.exeinstaller- Follow the installation wizard, accepting the default options
- Choose “Standard” installation type when prompted
Disk Space
Android Studio requires approximately 4GB of disk space for the IDE, plus additional space for the Android SDK and system images (typically 10-15GB total for a complete setup).
- Download Android Studio from the official website
Mac Chip Type
Make sure you download the correct version for your Mac:
- Apple Silicon (M1, M2, M3, M4 chips): Download the “Mac with Apple chip” version
- Intel: Download the “Mac with Intel chip” version
You can check your chip type by clicking the Apple menu and selecting “About This Mac”.
- Open the downloaded
.dmgfile- Drag Android Studio to the Applications folder
- Launch Android Studio from the Applications folder
- If prompted about the app being downloaded from the internet, click “Open”
- Download Android Studio from the official website
- Extract the downloaded archive:
1 sudo tar -xzf android-studio-*.tar.gz -C /opt/
- Run Android Studio:
1 /opt/android-studio/bin/studio.shDesktop Entry
To add Android Studio to your application menu, use Tools > Create Desktop Entry from within Android Studio after it’s running.
2. First Launch Configuration
When you first launch Android Studio, a setup wizard guides you through the initial configuration.
- On the welcome screen, click Next to begin setup
- Select Standard installation type (recommended)
- Choose your preferred UI theme (Darcula or Light)
- Review the SDK components to be installed:
- Android SDK
- Android SDK Platform
- Android Virtual Device (AVD)
- Accept the license agreements
- Click Finish to download and install the components
Warning
The initial download may take considerable time depending on your internet connection. The SDK components and system images are several gigabytes in size.
3. Configure SDK Components
After the initial setup, verify that all required SDK components are installed.
- Open Android Studio
- From the welcome screen, click More Actions (or use Tools menu if a project is open)
- Select SDK Manager
SDK Platforms Tab
Ensure you have at least one Android platform installed. For MAUI development, Android 14 (API 34) or higher is recommended.
SDK Tools Tab
Click the SDK Tools tab and verify these components are installed:
| Component | Purpose |
|---|---|
| Android SDK Build-Tools | Required for building Android apps |
| Android Emulator | The emulator itself |
| Android SDK Platform-Tools | ADB and other command-line utilities |
Check any missing components and click Apply to install them.
SDK Location
Note the SDK location displayed at the top of the SDK Manager. You may need this path later for environment variables or IDE configuration.
Default SDK location:
1 C:\Users\USERNAME\AppData\Local\Android\Sdk
Default SDK location:
1 /Users/USERNAME/Library/Android/sdk
Default SDK location:
1 /home/USERNAME/Android/Sdk
4. Create an Android Virtual Device (Pixel 9 Pro)
An Android Virtual Device (AVD) is an emulated Android phone that runs on your computer.
- From the Android Studio welcome screen, click More Actions
- Select Virtual Device Manager (or Device Manager in newer versions)
- Click Create Virtual Device
Select Hardware
- In the Category list, select Phone
- From the device list, select Pixel 9 Pro
- Click Next
Device Choice
The Pixel 9 Pro is a good choice for development as it represents a modern flagship device with a large screen. You can create additional AVDs with different screen sizes later to test your app’s responsiveness.
Select System Image
Choose a system image that matches your computer’s architecture:
Windows / Intel Mac Apple Silicon Mac
- Select the x86_64 tab (this should be the default)
- Choose a system image with API 34 or higher
- Look for images labelled with Google APIs for broader app compatibility
- If the image shows a download icon, click it to download the image first
- Click Next
- Select the arm64-v8a tab
- Choose a system image with API 34 or higher
- Look for images labelled with Google APIs for broader app compatibility
- If the image shows a download icon, click it to download the image first
- Click Next
Apple Silicon Performance
On Apple Silicon Macs, ARM-based system images run natively without emulation, providing significantly better performance than x86 images running through translation.
Configure AVD Settings
- Give your AVD a name (e.g., “Pixel_9_Pro_API_34”)
- Review the configuration settings:
- Startup orientation: Portrait (default)
- Emulated Performance: Hardware - GLES 2.0 (recommended)
- Click Show Advanced Settings to access additional options if needed
- Click Finish to create the AVD
Your new AVD should now appear in the Device Manager list.
5. Launch and Test the Emulator
- In the Device Manager, find your newly created AVD
- Click the Play button (triangle icon) to start the emulator
First Boot
The first time you start a new AVD, it may take a few minutes to boot as Android performs initial setup. Subsequent starts will be faster, especially if you enable snapshot saving.
Basic Emulator Controls
| Control | Description |
|---|---|
| Power button (side) | Turn screen on/off |
| Volume buttons (side) | Adjust volume |
| Extended controls (…) | Access additional features like GPS, battery, sensors |
| Rotate | Change orientation between portrait and landscape |
| Screenshot | Capture the current screen |
| Back | Android back navigation |
| Home | Return to home screen |
| Overview | Show recent apps |
6. Environment Variables (Optional)
Setting environment variables allows you to use Android SDK tools from the command line, which is useful for advanced workflows and connecting to a development container.
Set ANDROID_HOME
- Open the Start menu and search for “Environment Variables”
- Click “Edit the system environment variables”
- Click the “Environment Variables” button
- Under “User variables”, click “New”
- Set:
- Variable name:
ANDROID_HOME- Variable value:
C:\Users\USERNAME\AppData\Local\Android\Sdk- Click OK
Add to PATH
- In the same Environment Variables window, find “Path” under “User variables”
- Click “Edit”
- Click “New” and add:
%ANDROID_HOME%\platform-tools- Click “New” again and add:
%ANDROID_HOME%\emulator- Click OK to save
Close and reopen any command prompt windows for the changes to take effect.
Add the following lines to your
~/.zshrcfile (or~/.bash_profileif using Bash):
1 2 3 export ANDROID_HOME=$HOME/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/platform-tools export PATH=$PATH:$ANDROID_HOME/emulatorApply the changes:
1source ~/.zshrc
Add the following lines to your
~/.bashrcfile:
1 2 3 export ANDROID_HOME=$HOME/Android/Sdk export PATH=$PATH:$ANDROID_HOME/platform-tools export PATH=$PATH:$ANDROID_HOME/emulatorApply the changes:
1source ~/.bashrc
Verify the Setup
Open a new terminal and run:
1
adb --version
You should see output showing the ADB version number.
7. Connecting to a Development Container
If you’re using the containerised development environment from the Development Environment Setup tutorial, you’ll need to connect the container to the emulator running on your host machine.
Start ADB Server on Host
On your host machine (not in the container), start the ADB server in network mode:
Open a Command Prompt or PowerShell window and run:
1 2 adb kill-server adb -a -P 5037 nodaemon server startLeave this window open while developing.
Open a terminal and run:
1 2 adb kill-server adb -a -P 5037 nodaemon server startLeave this terminal open while developing.
Configure ADB in Container
Inside your development container, set the ADB server address:
1
export ADB_SERVER_SOCKET=tcp:host.docker.internal:5037
Then verify the connection:
1
adb devices
You should see your emulator listed:
1
2
List of devices attached
emulator-5554 device
For detailed instructions on building and deploying MAUI apps to the emulator from a container, see the Getting started with Visual Studio Code tutorial.
8. Troubleshooting
| Problem | Possible Cause | Solution |
|---|---|---|
| Emulator won’t start | Hardware acceleration disabled | Enable VT-x/AMD-V in BIOS (Windows/Linux) or ensure Hypervisor is enabled (Mac) |
| Emulator runs very slowly | No hardware acceleration | Install HAXM (Intel) or enable Hyper-V (Windows). On Apple Silicon, use arm64 images |
| “HAXM is not installed” | Missing Intel HAXM | Install HAXM from SDK Manager (SDK Tools tab) or use Hyper-V instead |
| AVD not visible in VSCode | AVD Manager extension not configured | Configure paths in VSCode AVD Manager settings |
| ADB cannot connect | ADB server not running | Start ADB server with adb start-server |
| Emulator freezes on boot | Insufficient RAM allocated | Edit AVD settings and reduce RAM or enable hardware acceleration |
| “System UI isn’t responding” | Emulator overloaded | Wipe data and cold boot the AVD, or increase allocated resources |
| Black screen after boot | Graphics driver issue | Change emulator graphics setting to “Software” in AVD configuration |
Cold Boot
If the emulator behaves unexpectedly, try a cold boot: In Device Manager, click the dropdown arrow next to the Play button and select “Cold Boot Now”. This restarts the emulator without using saved state.
Next Steps
- Development Environment Setup - Set up a containerised MAUI development environment
- Getting started with Visual Studio Code - Build and deploy MAUI apps to the emulator
- Git and GitHub - Version control for your projects