Running Emulator After Building Android from Source

Running emulator after building Android from source

I do not know for which product you do your build but to run emulator you can use the following command:

out/host/linux-x86/bin/emulator -sysdir out/target/product/generic/ -system out/target/product/generic/system.img -ramdisk out/target/product/generic/ramdisk.img -data out/target/product/generic/userdata.img -kernel prebuilt/android-arm/kernel/kernel-qemu -sdcard sdcard.img -skindir sdk/emulator/skins -skin WVGA800 -scale 0.7 -memory 512 -partition-size 1024

Just copy it into .sh file into the root of your Android source folder and run this file. Or you can just run it but you should chdir to your Android source folder root at first.

And do not forget to create an sdcard image in the root folder with command mksdcard.

Unable to start emulator after build AOSP

The emulator is added to current path when I run

source build/envsetup.sh
lunch full-eng

How to run an Android 10 system image built by myself on emulators?

After understanding more about AOSP build outputs (especially all the .imgs under out/target/product/generic_x86), here is what I did to load the self-built system image on Mac's emulators:

  1. Copy system-qemu.img to <android_sdk>/system-images/android-29/google_apis/x86 on the MacBook. Then rename system-qemu.img to system.img (You can delete the original system.img or just give it another name).
  2. Copy 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 with vbmeta.img, which is used to verify system.img. Without this file, your emulators cannot launch because of verification failure. Refer here for more details.

Just compiled AOSP, do I need AVD to run 'emulator'?

Bellow are the commands that successfully ran in my machine. Hope it may help you solving the issue.

$ export USE_CCACHE=1
$ ccache -M 10G
$ . build/envsetup.sh
$ set_stuff_for_environment
$ lunch full-eng
$ make -j16
$ emulator

to get the system.img to rebuild, you need to remove the following files/directories:

out/target/product/generic/obj/PACKAGING/
out/target/product/generic/system.img

Then simply repeat:

$ make -j16
$ emulator


Related Topics



Leave a reply



Submit