How can I run emulator without GUI (headless Android)?
My requirement is to run the headless Android on the emulator. Is it correct if I use ro.config.headless 1
? Or disable zygote?
How can I run emulator without GUI (headless Android)?
My requirement is to run the headless Android on the emulator. Is it correct if I use ro.config.headless 1
? Or disable zygote?
From: http://paulemtz.blogspot.com/2013/05/android-testing-in-headless-emulator.html
Then, to run the headless emulator:
emulator -avd test -no-skin -no-audio -no-window
The '-no-skin' option removes the emulator buttons such as the home and other hardware keyboard buttons.
The '-no-audio' option disables the audio support.
Finally, the '-no-window' option disables the emulator's graphical window display.
Note that -avd test
would need to be modified to refer to your specific emulator image (AVD).
One of the options to achieve that is to stop zygote
service when an emulator running. When stopping the zygote
process (aka app_process
) all of the system services, that were forked from zygote
at system boot, shuts down. Only a few native system services will be running. The emulator's display should show the startup logo (or animation).
The steps for stopping zygote
are as follows:
adb shell
su
(most of emulator images have /system/xbin/su
)stop zygote
After that you can explore how less services are running with service list
. Critical for Android Runtime services will be stopped, e.g.
activity: [] // ActivityManager
package: [] // PackageManager
display: [] // DisplayManager
...
To start zygote
execute:
start zygote
Note: with the @CommonsWare's solution you are still going to have zygote
and most of the Android system services running.