Android: Problems debugging with the emulator from eclipse

让人想犯罪 __ 提交于 2020-01-04 02:27:09

问题


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.


回答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.)




回答2:


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



来源:https://stackoverflow.com/questions/4731593/android-problems-debugging-with-the-emulator-from-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!