Detailed Instructions for Building Android 14 AOSP Emulator Post-QPR2 Update
After the release of Android 14 QPR2, there were significant changes in the build system. Unlike before, the lunch command no longer provides choices. Many users are confused because the official documentation is hard to understand, making it tricky to build the emulator. But no issues this article will explain how to build aosp emulator post Android 14 QPR2.
Step 1: Getting The source.
Aosp source can be downloaded easily like before with repo.
In a empty directory
repo init https://android.googlesource.com/platform/manifest -b android-14.0.0_r51 --depth=1
change "android-14.0.0_r51" to the branch you want
Now Sync the source using
repo sync -c --force-sync --optimized-fetch --no-tags --no-clone-bundle --prune -j$(nproc --all)
After the sync is complete lets move to next step.
Step 2: Setting up Build environment
the below code would setup the build environment.
. build/envsetup.sh
Step 3: Choosing the Target
This steps has become the most tricky after the QPR2 update because the lunch command takes a release target now.
for the x86_64 emulator
lunch sdk_phone64_x86_64-ap2a-userdebug
Here "sdk_phone" is the device we are building which is the emulator, "x86_64" is the target platform where emulator will run, "ap2a" is the release target used for android 14 right now (it may change later) and finally "userdebug" is the build type.
If its succeeds you will receive a output something like this:
Step 4: Building
Now just type "make" in your terminal and build will start!
make
Successful build output will be something like this:
Step 5: Running the emulator
type "emulator" in the same terminal and your emulator will start :)
emulator
BOOM!
I hope this article helps you ๐