开发者

Reconnecting Emulator to Eclipse

开发者 https://www.devze.com 2023-01-27 09:16 出处:网络
My main problem with developing in Android is that the emulator seems to continually get disconnected from eclipse. This always happens the 2-3 time I try to upload my .apk from eclipse without reboot

My main problem with developing in Android is that the emulator seems to continually get disconnected from eclipse. This always happens the 2-3 time I try to upload my .apk from eclipse without rebooting the emulator. Eclipse indicates this with an empty DDMS ->Device section and logcat stays blank - sometimes I'm not sure if the new code made it on the device.

The only fix I have for this is to shut down eclipse, and restart it. With the restarting of Eclipse, on top of the emulator boot time, I can't get any momentum going in my development.

Is there a way to reconnect the emulator to eclipse without having to restart Eclipse or even the Emulator?

Update: There were a couple of answers that helped, particularly "reset adb" or Kill-server -> connect adb. However, sometimes even that is troublesome.

I am going to try Pentium10's suggestion of hooking up my G1 and using it as an emulator, but for now, I have found that if I don't see my logcat going, and the emulator is working (This is my biggest problem, because I am outputting all my debug开发者_C百科ging messages to log) then I can open up CMD and type adb logcat. This streams the log into the command window. Not nicely color coded, but nice enough for me to find my problems...


In eclipse go to Window->Show View->Other->Android->Devices. When your application is run go to this tab and you will see the emulator. If your emulator becomes unresponsive, in the devices tab you will see a down arrow at the right. Click the arrow and a context menu shows up. Hit the option Reset adb.

Just had to do this and it worked beautifully, but it did require you to reset the emulator - though I didn't wait to see if it reconnected on its own.


Try to call 'Reset adb' menu item from DDMS > Devices tab. It helps me in this case.


At most of the time you don't need to restart the emulator.

AFAIK the only workaround for this is to restart Eclipse (I always use this), or use a real phone.


Try adb kill-server, followed by an adb connect


I've had luck reconnecting to the disconnected emulator by entering an adb-over-tcp command line which you can look up in the docs. I think the address and port to use are the ones in the title bar of the emulator window, if not try the next higher port. Once it's back in adb devices eclipse should use it.


in terminal:

$adb kill-server && adb start-server
0

精彩评论

暂无评论...
验证码 换一张
取 消