Emulator-5566 Offline – Or Unkown Device in Android Studio
By Mike Roberts
I wanted to write about this experience since I didn’t find much on Google to help me out with this issue, and hopefully this will save some people a good amount of time.
The other day I had an issue with an Unkown Device in my emulator list in Android Studio. I thought, “That’s weird,” and then ran adb devices
to see what it said there.
→ adb devices
List of devices attached
emulator-5566 offline
Ok, not much more info there. So I tried to connect/reconnect with no luck. Tried Rebooting the device through adb and restarting the adb daemon with no luck. Which brought me to Google. Basically the only advice I could find on Google was to restart adb and it’ll go away, but I already tried that and that wasn’t the case. I stumbled upon a blogpost that talked about a Visual Studio Code plugin causing this issue. It turns out this wasn’t my case either but it did have some great steps to figure out what my problem was.
The instructions in that blog post are for Windows/Powershell though, so they didn’t really translate to macOS, but were a good starting point. Here’s how I figured out what was going on:
- Run
netstat -anv | grep 556
where 556 is the first three numbers ofemulator-5566
. Look for the local address that has those three in it, usually127.0.0.1
followed by your three numbers. In my case this is the line I was looking for.
tcp4 0 0 127.0.0.1.5567 127.0.0.1.64710 ESTABLISHED 408177 146988 42357 0 0x0102 0x00000004
- Use that process id (42357 in my case) to find out what’s creating that phantom emulator. You can run
ps
in CLI or use Activity Monitor and look for the proccess id in there.
Sure enough after I quit Framer X the phantom emulator is gone.
→ adb devices
List of devices attached
So apparently Framer X is doing something that makes adb think it’s an Android Emulator. If running adb install causes problems because there are multiple devices and one is offline with a generic name, then either quit Framer X 😉 or run these steps to figure out what your culprit is.