1

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?

frogatto
  • 28,539
  • 11
  • 83
  • 129
Richard Hu
  • 811
  • 5
  • 18
  • Are you using ssh to connect to your server? If so you could use [X11 Forwarding](https://stackoverflow.com/questions/19589844/set-up-x11-forwarding-over-ssh) to run the emulator server-side. You can then run `set_stuff_for_enviroment` on the server to add `emulator` to your path then run `emulator`. – Peter Warrington Mar 17 '19 at 17:59
  • Hi Peter, thanks for your reply! Actually I have successfully lunch the emulator on the server using `ssh -Y xxx@xxx`. But it turns out the GUI runs extremely slow. That's the reason why I am looking for other choices. – Richard Hu Mar 18 '19 at 09:25

1 Answers1

3

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.

Richard Hu
  • 811
  • 5
  • 18