Android emulator hanging on startup?
I had this problem and fixed it by deleting the emulator and creating a new one. In eclipse:
- 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 :)
Try using 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.
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 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.