Tip: Using an "unknown" Android device with AndroidStudio

(This is a post I made on a Coursera forum, 2015-06-11. Maybe useful to someone.)

I'm running AndroidStudio on Ubuntu 14.04LTS, and my phone's a Huawei Ascend G600 running Android 4.0.4.

I wanted to hook my phone up with AndroidStudio, via USB, to avoid using the emulator as much as possible. But it turns out that adb fails to look up a valid device ID for my phone:

$ adb devices
List of devices attached
????????????    device

So, adb does see a device there - and it does interact properly with it, sending commands, running a shell, etc., as it should. But for some reason it can't return a valid device ID for it. Which, in turn, prevents AndroidStudio talking to my phone at all. So I figured I'd be stuck with using the emulator after all.

The day after (hrmpf!) submitting my ModernArtUI project, I had some time to kill... so I went and read a bit more about adb. It turns out that, starting with a USB connection, you can switch to a Wi-Fi connection that AndroidStudio is able to interact with:

$ adb usb
restarting in USB mode

$ adb devices
List of devices attached
????????????	device

$ adb tcpip 5555
restarting in TCP mode port: 5555

Next find the phone's IP address via Settings → About → Status → IP address, and then...

$ adb connect IP_ADDRESS
connected to IP_ADDRESS:5555

$ adb devices
List of devices attached
????????????	device
IP_ADDRESS:5555	device

At this point AndroidStudio lists my Huawei G600 in its "Choose a running device" dialog, and it's soooo much nicer than the emulator :^)

When finished, disconnect with:

$ adb disconnect IP_ADDRESS

I guess I'm not the only one who has/will run into this problem, so...



trmusson@gmail.com | VKontakte
2017-07-08

Free Software Foundation Valid XHTML 1.0!