Android emulator-5554 offline

后端 未结 30 1650
旧时难觅i
旧时难觅i 2020-11-28 21:58

I\'m having a problem with emulator-5554, it keeps telling me it is offline.

When I do a adb devices from the command line it says

30条回答
  •  伪装坚强ぢ
    2020-11-28 22:40

    This solution is for Windows.

    (See @Chris Knight's solution for Mac/Linux)

    1. Start Windows Powershell:

      Start -> type 'powershell' -> Press ENTER

    2. Run the following command: adb devices


    PS C:\Users\CJBS>adb devices
    List of devices attached
    emulator-5656   host
    emulator-5652   host
    12b80FF443      device
    

    In this case, 12b80FF443 is my physical device, and the emulator-* entries are garbage.

    1. Per @Brigham, "The way that Android detects emulators is by scanning ports starting at port 5555.". The port number is indicated after the emulator name (in this case 5656 and 5652). The port number to check is the emulator port number plus 1. So in this case:-

      5656 + 1 = 5657

      5652 + 1 = 5653

      So let's see which program is using these ports. In this case, the ports to check both start with "565". So I'll search for ports in use starting with 565. Execute: netstat -a -n -o | Select-String ":565"


    PS C:\Users\CJBS> netstat -a -n -o |  Select-String ":565"
    
      TCP    127.0.0.1:5653         127.0.0.1:5653         ESTABLISHED     5944
      TCP    127.0.0.1:5657         127.0.0.1:5657         ESTABLISHED     5944
    
    1. The final field in this output is the PID (Process ID) - in this case it's PID 5944 for both of these two ports. So let's see what this process ID is. Execute: tasklist /v | Select-String 5944. Replace 5944 with the output of the previous command:

    PS C:\Users\CJBS> tasklist /v | Select-String 5944
    
    adb.exe                       5944 Console                    1      6,800 K Running         MyPCName\CJBS          0:06:03 ADB Power Notification Window
    

    What a surprise. It's ADB. As noted by other answers, it could be other programs, too.

    1. Now, just kill this process ID. Execute kill 5944, replacing 5944 with the PID in the previous command.

    PS C:\Users\CJBS> kill 5944
    
    1. To confirm that the spurious emulator is gone, re-run the following command: adb devices

    PS C:\Users\CJBS>adb devices
    List of devices attached
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    12b80FF443      device
    

    ADB re-starts (as it was previously killed), and it detects no more fake emulators.

提交回复
热议问题