How long does the Android Emulator take to start? Do you need to close/start if every time you change Java code?

StackOverflow https://stackoverflow.com/questions/2479550

  •  21-09-2019
  •  | 
  •  

Question

When developing for Android do you typically need to stop the emulator and restart it every time you make a change to your Java code or is there a faster way? The emulator takes about 1.5 minutes to start for me, is this normal?

Was it helpful?

Solution

Yes. Starting an emulator is slow, but you don't need to reboot it usually when you make changes. You can just target the already running emulator, at least in eclipse.

OTHER TIPS

It is worthwhile to use the "Snapshot" functionality of the emulator. It can be enabled when you create (or you can edit) your AVD image.

This will take a "Snapshot" of the emulator image when you stop running. Then it restarts the emulator to that exact same place.

When using this feature, the emulator start-up time is sped up by a factor if 10+ (I see a 10 sec start-up compared to 90 sec to bring it up from scratch).

It is important to note, that this will maintain "state" of your emulator between runs. This can be useful if you are trying to test a particular scenario. It can be bad if you run your emulator out of memory, then "snapshot" that (at which point, you can always take a fresh snapshot, and start again).

The emulator take some time to start, depending on the running machine and the amount of programs you are running on the host.

If you installed the eclipse plugin, you don't need to restart the emulator each time: simply hit run in eclipse, and the plugin will take care of making the .apk package, put it in the device and start the activity (if any).

There is really no need to restart the emulator. You can keep it running all day (or longer). If you do not use eclipse: adb install -r will do the job (-r to replace the existing package) and restart your app.

Mine takes a minute + to start. I tried adding -no-boot-anim to speed it up, but the few tests I did it did not speed it up.

There is no need to close Android Emulator when you changes in code just simple do one thing

  • Leave AVD running and you will have to press F11 (or run your app), make sure you are at home screen of AVD.

To start the emulator in Eclipse, go to Window -> Android SDK and AVD Manager, then select the virtual device you want and hit start. This way it will stay on and not shutdown when your app terminates.

I have noticed that sometimes I have to shut down the emulator and restart it. It appears to hang at "waiting for home to launch". This only hangs the first time. Once it successfully launches I can reinstall repeatedly with no issues.

Yes, as everyone said you don't have to restart the emulator. I'm not sure if it's my computer (obviously to some degree it would be) but even when I simply make a one line change and relaunch, eclipse/AVD take roughly 2-3 minutes to fully load my new package to the emulator. Sucks having to wait this long between changes, but it also makes you want to write better code the first time rather than being sloppy and just test the results.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top