Search code examples
androidandroid-emulatoradb

How to remove an offline emulator from avd devices?


I've created a couple of AVD-s in Android Studio. They were launching on emulator port 5554. Then I've created another AVD via android avd application, and they are starting on port 5556.

Now with a single emulator running, I get the following output from adb devices -l:

List of devices attached
emulator-5556          device
emulator-5554          offline

I'm using the tooling which cannot supply the -s (specific device) option to adb, so when trying to install an app, I get an error:

error: more than one device/emulator

And I'd like that there be a single connected emulator: the only one that I'm running.

I thought that removing the old Android Studio-created devices would do the trick of removing the emulator-5554, but nope. Even new devices created in Studio will open on 5556. So I've ended up with a forever-offline zombie emulator-5554 that screws up my build tooling.

How can I force the new emulators to be run on port 5554 and/or remove the offline emulator-5554?

(Running Ubuntu 16.04 if it matters.)


Solution

  • When I am facing the same issues than doing like below:

    1. Restart adb by issuing adb kill-server followed by adb start-server in a command prompt
    2. Disable and re-enable USB debugging on the phone
    3. Rebooting the phone if it still doesn't work.

    99% of my issues have been resolved with these steps.