3

This is driving me crazy. Like these people, slow-android-emulator, I'm finding running the emulator from eclipse is slow and problematic. As suggested, I've tried running the emulator seperately. But then I don't get my latest changes. I don't know eclipse that well, but I would like something like 'build' and then somehow load the latest image into the emulator.

Also, I've tried keeping the emulator open and the continually use run->debug, but after 2 or 3 times, I get errors like the following:

Failed to install HelloAndroid.apk on device 'emulator-5554': timeout
Launch canceled!


emulator: ERROR: the user data image is used by another emulator. aborting


Waiting for HOME ('android.process.acore') to be launched...
emulator-5554 disconnected! Cancelling 'com.example.helloandroid.HelloAndroid activity launch'!

java.lang.NullPointerException
at com.android.ddmlib.Client.sendAndConsume(Client.java:571)
at com.android.ddmlib.HandleHello.sendHELO(HandleHello.java:142)
at com.android.ddmlib.HandleHello.sendHelloCommands(HandleHello.java:65)
at com.android.ddmlib.Client.getJdwpPacket(Client.java:670)
at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:317)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)

I've tried killing and restarting the adb server to no avail.

Once again, briefly, I would just like a 'system' where I can effectively make changes, load them into the emulator and test.

Community
  • 1
  • 1
James John McGuire 'Jahmic'
  • 11,728
  • 11
  • 67
  • 78

2 Answers2

1

The emulator is usually slow, but once started usually I never had to restart.

If you feel that running emulator from outside eclipse is faster, then you can run the emulator outside eclipse and in the android application Run --> Configuration, you can choose "preferred avd" and uncheck automatic target mode. (Also it tells me that your eclipse probably does not have enough memory. You need to change vmargs if you have allocated very little memory. More on that later).

Also when you want to debug again after making some code change, are you closing the debugging session (The red button in your debug window) and starting a new one. The emulator does not handle hot swapping all that well.

(Note: Please try using Jconsole or some other profiler and paste the memory usage or at least check memory usage in task manager.)

uncaught_exceptions
  • 21,712
  • 4
  • 41
  • 48
  • Just wanted to add this. If you hate your emulator, you can still use your phone. Its really fast that way. (I only while I come across a emulator limitation like accelerometer) – uncaught_exceptions Jan 19 '11 at 04:50
  • Agree - Except for when I am testing sql issues and purposely corrupting my database etc. I test on the real target. I think the only advantages that the simulator gives you is that you can screw with the raw database file to test your error handling robustness and you can simulate different screen densities and resolutions. Unless you are doing one of those two things then the hardware is much faster and does everything that you need. – w.donahue Jan 19 '11 at 05:26
  • Great suggestions so far. One point, often my debug commands are grayed out while the app is running even though I started the app from the debugger. Disconnection, I assume. Is there a way to reconnect? – James John McGuire 'Jahmic' Jan 19 '11 at 07:39
  • @Jahmic. Probably not disconnection. Please see your android logcat. If there is a disconnection there will be a red message (log.severe) displayed indicating that the connection lost or refused by {avd name}. (android logcat tab is available at the lower left cornet of my IDEA, unfortunately I do not know where is in eclipse, but should be in similiar position) – uncaught_exceptions Jan 19 '11 at 07:45
  • from logcat: WARN/ActivityManager(62): Launch timeout has expired, giving up wake lock! also: 01-19 17:03:11.118: ERROR/jdwp(239): Failed sending req to debugger: Broken pipe (-1 of 27) – James John McGuire 'Jahmic' Jan 19 '11 at 08:08
  • You do have some serious problem with your emulator. Please mention OS version, Android Version , 64 Bit or 32 Bit OS, Java Version. There is a few noted problem while running in windows 7 64 bit with Jdk1.6 32 bit. I think the Dalvik jvm has some issues and may be the only thing you can do is deleting and updating your sdk. – uncaught_exceptions Jan 19 '11 at 08:16
  • winXP, The latest Java (1.6?) and latest Android sdk I just downloaded as of 2 weeks ago. PC is a little slow, so isn't helping the process. – James John McGuire 'Jahmic' Jan 19 '11 at 11:35
  • Marked as answered since these were pretty good suggestions, but still looking for more suggestions – James John McGuire 'Jahmic' Jan 24 '11 at 05:25
  • Two questions. Does the emulator run any better if you run outside eclipse? Is eclipse in general faster? If emulator does ok, if run outside, then you should change the vm args of eclipse. Else there is no option other than increasing the speed of your cpu ( since emulator stimulates the device, it is not essentially multithreaded and does not use cpu cores, so more cores does not help). Changing heap size in eclipse: http://wiki.eclipse.org/FAQ_How_do_I_increase_the_heap_size_available_to_Eclipse%3F (Note: did you monitor eclipse performance using jconsole) – uncaught_exceptions Jan 24 '11 at 05:57
  • Just in case, someone is viewing this, who is also having problems like this, getting a new machine with lots of RAM helps immensely... Needless to say perhaps – James John McGuire 'Jahmic' May 12 '11 at 09:58
0

please try current avd(emulator) cancel and again start that avd(emulator).

AnilPatel
  • 2,356
  • 1
  • 24
  • 40