I’ve been modifying/editing parts of the Android platform, but have run into a problem when trying to test my edits. After making my changes to the platform source, I was able to successfully compile the source – thus creating system.img, ramdisk.img, and userdata.img.
When I go to test this in the emulator, the emulator just hangs on the “ANDROID_” screen, with the underscore blinking, but never seems to load. Any suggestions?
The command I used to run the emulator is as follows:
./emulator -system $HOME/android/platform/out/target/product/generic/system.img -ramdisk $HOME/android/platform/out/target/product/generic/ramdisk.img -data $HOME/android/platform/out/target/product/generic/userdata.img
The first startup can take a while, especially on a slow machine but otherwise try running the adb logcat command to see the log output. That will help you determine what the problem could be.
Also if you like to skip supplying all the options to the emulator, i.e. -system and the other you can use the scripts supplied in the build folder. Run these commands from the open source project root folder:
source build/envsetup.sh setpaths
The first one will run the envsetup script for Android that supplies a number of helpful commands. The second one sets up all the paths needed for Android platform development. Among them are the ANDROID_PRODUCT_OUT variable that informs the emulator where to look for the build images. It is set to the default folders that you have specified above. After running setpaths you can just start the emulator with your build by typing emulator on the command line.
I had this problem and fixed it by deleting the emulator and creating a new one.
- Menu Window -> Android SVK and AVD Manager
- Select Virtual devices (should be selected already)
- Select the emulator giving you problems
- Edit to see the setting and remember them.
- Delete the emulator.
- Create a new one that is the same as the old one.
- Start the emulator from here with the start button.
It started in about 30 seconds after I did that.
Normally the emulator starts in about 2-3 minutes for me. Then it mysteriously stopped working. I was seeing boot animation for 30 minutes before I gave up. Rebooting my laptop didn’t help, which made me think it was a problem with the emulator settings, and I stumbled on this solution.
- Note #1: Doing this will wipe your user data.
- Note #2: As mentioned else where, it’s a good idea to check “Enabled” for the Snapshot when you create or edit the emulator, this lets you do faster startup next time.
- Note #3: My new emulator came up in chinese. That’s kinda of weird 🙂
adb logcat in the terminal to see what’s happening with the emulator. When I did that I kept noticing
I/ServiceManager( 918): service 'media.audio_flinger' died I/ServiceManager( 918): service 'media.player' died I/ServiceManager( 918): service 'media.camera' died I/ServiceManager( 918): service 'media.audio_policy' died
repeating every 10s or so. I tried enabling my cameras in the AVD and the emulator started working.
To enable the camera enter
android avd in the terminal and set the front and back camera options.
I had a similar problem. The emulator was unresponsive and Android Studio was unable to deploy and run the application. My solution was the following:
1. Open the AVD manager
2. On right hand side menu of the virtual device issue the commands “Stop” and “Wipe data”
3. Then, do a cold boot of the virtual device
and voila, it came back to life.
I normally have to restart it to get it to run. Today it wouldn’t restart no matter what. Doing a ./adb logcat consistently showed ‘waiting for device’. So I restarted it using Eclipse Android SDK and AVD Manager / Start… (option), un-checking the ‘Launch from snapshot’ option, and after the long grind of load it, the emulator works.
My trick to get the emulator started on a weak machine (RAM: just 1 GB) is to start it as first thing after WinXP has finished booting. Further, using an emulator instance with a smaller resolution (smaller number of pixels on display to emulate, e.g. just 240×400) did also help.