1

I've seen this question asked in reverse but:
I'm an Android developer on a Windows machine with a Google Pixel 1. I want to use adb to debug my code on it, but whenever adb starts it launches an emulator

List of devices attached
FA6A40303383 device
emulator-5562 offline # I don't want this to start!

I can understand why someone would want this, but I under no circumstance want this emulator to launch. This is so adb automatically uses my phone instead of asking me to specify the device/emulator.

I installed the SDK using NVidia's CodeWorks for Android (1R7) - I did have Android Studio installed at one point, but I uninstalled it (and removed all User/.android* directories) and did a complete uninstall / reinstall of Codeworks for Android, but the emulator still starts.

I'm not used to seeing it there and it's kind of messing with my workflow - is there a way to prevent it from starting?

Zoe
  • 23,712
  • 16
  • 99
  • 132
mynameisjohnj
  • 341
  • 1
  • 12
  • Do the phone you are attaching has the debug mode enabled? – acarlstein Mar 01 '19 at 23:33
  • It does have developer mode enabled, and I can use ADB with the phone fine. The emulator shows up regardless of whether or not the phone is pluggd in - it seems to start as soon as I launch ADB for the first time. – mynameisjohnj Mar 02 '19 at 03:16

1 Answers1

5

Try searching for processes running on TCP port 5563 (5562 + 1, I forget the explanation for this). ADB looks for processes running on TCP ports 5555+.

For me, I use Native Instruments software which starts something called an NTKDaemon on TCP port 5563, which was the direct cause of the dummy emulator. I knocked my head against this wall for two weeks or so before figuring this out.

This SO answer put me on the right path to finding the process: https://stackoverflow.com/a/53680440/2363258, though it's in a windows environment

In the end this was my fix:

$ adb devices -l
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
emulator-5562          offline transport_id:1


~
$ lsof | grep 5563
NTKDaemon  389  tim   19u     IPv4 0x8d889cdf67e44dd9        0t0     TCP localhost:5563 (LISTEN)
NTKDaemon  389  tim   26u     IPv4 0x8d889cdf75b8f3d9        0t0     TCP localhost:5563->localhost:49306 (ESTABLISHED)
adb       1074  tim    7u     IPv4 0x8d889cdf75b8d759        0t0     TCP localhost:49306->localhost:5563 (ESTABLISHED)

~
$ kill -9 389

~
$ adb devices -l
List of devices attached


~
$
Zoe
  • 23,712
  • 16
  • 99
  • 132
Timmay
  • 81
  • 1
  • 3
  • 1
    Sorry for the late response, but you were right! I also use some NI software, and killing NTKDaemon (in Task Manager on Windows for me) killed the rogue emulator! I had no idea the NI stuff would relate to this issue...wild! – mynameisjohnj Jun 17 '19 at 19:59
  • same thing for me on macOS 10.14. Thank you! – Cody Sand Dec 12 '19 at 20:12
  • Hi. Instead of `lsof | grep 5563`, the following is more reliable and faster: `lsof -i :5563 -n -P` – Wodin Nov 19 '20 at 04:04