How to attach back the Android emulator to ADB?

前端 未结 7 1978
北恋
北恋 2020-12-02 08:58

After I start the emulator by hitting Debug in Eclipse, after certain time it disconnects from the ADB, but the emulator stays open. It is responsive, I can navigate and sta

相关标签:
7条回答
  • 2020-12-02 09:10

    As you said, the problem is not Eclipse losing contact with the Emulator, but ADB - the Android Debug Bridge - losing contact with it. As Eclipse uses ADB to communicate with the emulator when ADB is broken Eclipse can do nothing.

    To fix this stop the ADB server by running the following command:

    adb kill-server
    

    Eclipse will then usually try to restart ADB, or you can restart it yourself by running an ADB command, such as:

    adb devices
    

    If you do, you'll see output like this:

    * daemon not running. starting it now *
    * daemon started successfully *
    List of devices attached
    emulator-5554   device
    

    You can also do this via the mouse, using the Reset adb option in the Devices view in Eclipse.

    alt text

    It's also worth noting the Console view has two modes, DDMS and Android. You're usually in Console mode but it's DDMS mode which will show ADB status messages. Select modes by clicking the button with the Monitor icon, or using the arrow next to it:

    alt text

    If all else fails, try killing the adb processes from the OS. On Windows XP I use:

    TASKKILL /F /IM adb.exe
    
    0 讨论(0)
  • 2020-12-02 09:10

    on a mac, i just had to kill adb from activity manager and manually re-open the program again. had eclipse open all through and it worked just fine.

    0 讨论(0)
  • 2020-12-02 09:20

    Try with adb kill-server and adb start-server. Even then the same problem occurs kill your running process from ddms prespective. Refer this link(http://www.jiahaoliuliu.com/2011/02/stopping-android-applications-already.html). This solved my issue. Hope for you also.

    0 讨论(0)
  • 2020-12-02 09:23

    There is an easier way. From eclipse you can reset the adb from DDMS panel. Here's a short video on doing that "Reset ADB on DDMS"

    Here's a quick screenshot of where you can get the option.enter image description here

    0 讨论(0)
  • 2020-12-02 09:27

    Sometimes a kill-server won't help at my machine (WinXP). For example I can't see the emulator in the DDMS-View any more or I do see it but no processes running on it.

    In these cases I close the emulator and eclipse and manually kill the adb.exe-process from the process list.

    When I then restart eclipse and the emulator, everything's fine again.

    Now I just need a keyboard-shortcut for that :-)

    0 讨论(0)
  • 2020-12-02 09:29

    I am testing an application on an Android 4.0 (API level 14) emulator and once I run the app the emulator starts up and as soon as it loads, Eclipse DDMS disconnects from the emulator.

    Here is the workaround that I am using: Open terminal, navigate to platform tools (C:\android-sdk\platform-tools\ or wherever you have your android-sdk installed), and run adb kill-server, and then run, adb start-server. DDMS should now list the emulator - from Java perspective, right click on the app -> Run As -> Android Application.

    Hope this helps.

    0 讨论(0)
提交回复
热议问题