Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Android emulator from starting?

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?

like image 802
mynameisjohnj Avatar asked Jan 02 '23 05:01

mynameisjohnj


1 Answers

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


~
$
like image 52
Timmay Avatar answered Jan 04 '23 17:01

Timmay