Search code examples
androidandroid-emulatorandroid-sourceandroid-build

Cannot launch Android emulator using customized built system images


I built an Android source on my server successfully. The commands I used are

source build/envsetup.sh
lunch aosp_x86-eng
make -j32

I can also run the emulator successfully on the server without GUI because the server has no available video device. In order to visually see the emulator, I followed the steps mentioned in here and here to move several built images to my laptop (a MacBook Pro). Basically, I used Android Studio to create a x86 emulator and copied several image files (e.g., system.img, ramdisk.img, userdata.img) into the corresponding avd folder. However, when I try to launch the emulator, it only shows a blank screen without any progress even after 5 mins. I have tried to switch off gpu, switch to software rendering, and switch to cold boot but with no success.

I don't understand the reason because it seems others can succeed after following these steps. Can anyone tell me what mistakes I made?


Solution

  • After several days of search, it turns out the answer is pretty simple. Here is what I did to make it work:

    1. Download Intel x86 Atom System Image (previously I only had Google APIs Intel x86 Atom System Image) in Android Studio.
    2. Create an emulator without Google APIs.
    3. Copy the system.img and ramdisk.img I built on server into <SDK folder>/system-images/android-XX/default/x86/ on my MacBook.
    4. Lunch the emulator and it works pretty well.

    I also found if using an emulator with Google APIs, it can only work in software - GLES 2.0 mode. But WebView doesn't work in such mode.

    So it seems the reason of a blank screen is because I use an emulator with Google APIs... I don't know why but it works.