I follow the Android doc to build an AOSP (Android 10).
source build/envsetup.sh
lunch aosp_x86-eng
m -j32
Once building successfully, I use the emulator
command to test if the built image can run. On my server running CentOS 8 Stream, the emulator can launch successfully and everything looks good.
However, when I try to move the built system image to my MacBook, the emulator only shows a blank screen even after 5 minutes.
I used to build an Android 7 system image (see here). All I need to do is to move the system.img
and ramdisk.img
to my MacBook’s SDK folder. But this does not work for Android 10.
What should I move (e.g., system.img
, ramdisk.img
, vendor.img
, userdata.img
…) to make the built AOSP running on my Mac’s emulators?
2
Answers
After understanding more about AOSP build outputs (especially all the
.img
s underout/target/product/generic_x86
), here is what I did to load the self-built system image on Mac's emulators:system-qemu.img
to<android_sdk>/system-images/android-29/google_apis/x86
on the MacBook. Then renamesystem-qemu.img
tosystem.img
(You can delete the originalsystem.img
or just give it another name).VerifiedBootParams.textproto
to<android_sdk>/system-images/android-29/google_apis/x86
on the MacBook. Also remember to delete or rename the original one before copying. I guess it has something to do withvbmeta.img
, which is used to verifysystem.img
. Without this file, your emulators cannot launch because of verification failure. Refer here for more details.The LineageOS wiki has instructions on exporting the compiled emulator images and running them independently in an Android Virtual Device.
They should still work for pure AOSP as well.
Essentially, you can run
mka sdk_addon
to build a .zip file that contains all the necessary images for running the build in an emulator.