Setup Run Android 9 for Development: Step-by-Step
In this article
To set up Android 9 (API 28) for development, you need to install Android Studio, create an emulator with the Android 9 system image, and configure your project to target that API level. This guide walks you through the official, supported process, covering both the emulator and a physical device. You'll need a computer with at least 8GB RAM (16GB recommended), about 10GB of free disk space, and a stable internet connection.
What You'll Need
- A computer running Windows, macOS, or Linux (64-bit)
- Android Studio (latest stable version) – download from the official Android developer site
- Java Development Kit (JDK) – Android Studio bundles its own, but if you need a standalone JDK, use version 8 or 11
- An Android device (optional, for physical testing) with USB debugging enabled
Step-by-Step
- Install Android Studio – Download the installer from the official Android developer website and run it. Follow the on-screen prompts, accepting the default components (Android SDK, emulator, and platform tools). After installation, launch Android Studio.
- Open the SDK Manager – On the welcome screen, click "Configure" (gear icon) and select "SDK Manager". Alternatively, if you have a project open, go to Tools > SDK Manager. Note: menu labels can differ slightly by version, but the SDK Manager is always under the Tools or Configure menu.
- Install Android 9 (API 28) platform – In the SDK Manager, click the "SDK Platforms" tab. Check the box next to "Android 9 (Pie)" (API 28). Also ensure "Android SDK Platform-Tools" is checked under the "SDK Tools" tab. Click "Apply" and then "OK" to download and install. Accept any license agreements.
- Create an Android Virtual Device (AVD) with Android 9 – In Android Studio, open the AVD Manager by clicking the device icon in the toolbar or going to Tools > AVD Manager. Click "Create Virtual Device". Choose a device definition (e.g., Pixel 3) and click "Next".
- Select the Android 9 system image – In the system image list, look for the "Pie" (API 28) row. If you don't see it, click the "Download" link next to it. Once downloaded, select it and click "Next".
- Finish AVD creation – Review the AVD configuration (name, orientation, etc.) and click "Finish". The AVD now appears in the AVD Manager list.
- Start the emulator – In the AVD Manager, click the green play button next to your Android 9 AVD. Wait for the emulator to boot. It may take a few minutes on first launch.
- Create or open a project targeting API 28 – If you're starting a new project, choose "Empty Activity". In the project's
build.gradle(Module: app) file, setcompileSdkVersionandtargetSdkVersionto 28. For an existing project, edit these values and sync the Gradle files (click "Sync Now" when prompted). - Run your app on the emulator – With the emulator running, click the "Run" button (green triangle) in the toolbar. In the "Select Deployment Target" dialog, choose your Android 9 emulator and click "OK". The app builds and installs on the emulator.
- Using a physical device (optional) – Enable Developer Options on your Android device by going to Settings > About phone and tapping "Build number" seven times. Then go to Settings > Developer options and enable "USB debugging". Connect the device via USB, and when prompted on the phone, allow USB debugging. The device will appear in the "Select Deployment Target" dialog. Select it and run the app.
Common Mistakes
- Forgetting to install the API 28 platform – If you only install the latest API, your project may not compile for Android 9. Always use the SDK Manager to add API 28.
- Using an incompatible system image – The AVD Manager may show multiple images for API 28 (e.g., Google APIs, Google Play). Choose one that matches your needs; the Google Play image has Play Store but is not rootable, which can limit some development tasks.
- Not syncing Gradle after changing SDK versions – After editing
build.gradle, you must sync the project. If you don't, you'll see errors like "SDK location not found" or "Failed to resolve" – click "Sync Now" or go to File > Sync Project with Gradle Files. - Emulator not starting due to hardware acceleration – On Windows, ensure Intel HAXM or Windows Hypervisor Platform is installed. On macOS, enable Hypervisor.framework. Check the SDK Manager's "SDK Tools" tab for HAXM and install it if missing.
Tips
- Use the "Google APIs" system image instead of the plain AOSP image – it includes Google Play services, which many apps depend on.
- In the AVD Manager, enable "Enable Device Frame" for a more realistic look, but disable it for better performance.
- Set the emulator's RAM and storage in the AVD configuration to match your computer's resources (e.g., 2GB RAM, 2GB storage).
- Use the command line to start the emulator faster:
emulator -avd your_avd_namefrom the SDK'semulatorfolder. - Keep your Android Studio and SDK tools updated to avoid compatibility issues with newer Gradle plugins.
Troubleshooting
If the emulator fails to boot or crashes:
- Restart Android Studio and the emulator.
- Check that your computer's virtualization (Intel VT-x or AMD-V) is enabled in BIOS/UEFI.
- In the AVD Manager, click the down arrow next to the play button and select "Cold Boot Now" to clear any corrupted state.
- If using Windows, ensure HAXM is installed: open SDK Manager > SDK Tools, check "Intel x86 Emulator Accelerator (HAXM)", install, and run the installer from the SDK's
extrasfolder.
If your app fails to install with "INSTALL_FAILED_OLDER_SDK":
- Your app's
minSdkVersionis higher than 28. Lower it inbuild.gradleto 28 or less, then sync.
If the emulator is extremely slow:
- Close other heavy applications.
- In the AVD Manager, edit the AVD and reduce the resolution or RAM, or enable "Use Host GPU" in the AVD's advanced settings.
- Try a lower-resolution device definition (e.g., Pixel 2 instead of Pixel 4).
If the physical device is not recognized:
- Ensure USB debugging is enabled (Settings > Developer options).
- Try a different USB port or cable (avoid charge-only cables).
- On Windows, install the proper USB driver from the device manufacturer's website.
- Run
adb devicesin a terminal – if the device shows as "unauthorized", unlock the phone and accept the RSA fingerprint prompt.
Frequently Asked Questions
Do I need to install Android Studio to develop for Android 9?
Yes, Android Studio is the official IDE and includes the necessary SDK tools. You can use command-line tools, but Android Studio simplifies setup and testing.
Can I use an older version of Android Studio?
Yes, but it must support API 28. Android Studio 3.3 and later support API 28. However, using the latest stable version is recommended for better performance and security.
What is the difference between the "Google APIs" and "Google Play" system images?
The "Google APIs" image includes Google Play services but not the Play Store app. The "Google Play" image includes the Play Store but restricts root access. For most development, the Google APIs image is sufficient.
How do I change an existing project to target Android 9?
Open the module's build.gradle file, set compileSdkVersion and targetSdkVersion to 28, and sync the project. You may need to update dependencies to versions that support API 28.
Why does my emulator show a black screen?
This often happens due to a corrupted system image or insufficient graphics acceleration. Try cold booting the AVD, or in the AVD settings, switch the graphics to "Software" (though this is slower). If that fails, delete the AVD and recreate it.
Can I test on a physical device running Android 9?
Yes, any device running Android 9 works. Enable Developer options and USB debugging as described in Step 10. The device will appear in the deployment target list.