Nexus 5X not identified correctly in Android Studio

755 Views Asked by At

I'm (very) new to Android development, and am trying to test my app on my Nexus 5X. I've previously done it successfully, on the same 5X, with the same version of Android Studio on the same computer, so I'm not sure what's changed.

With the phone connected via USB to my laptop running Linux Mint (18.1), in the 'Select Deployment Target' screen in Android Studio (v2.3.1) under 'Connected Devices', I see a single entry:

00b9xxxxxxxxcb26 [null]

(that's a full ID, but I'm not sure how sensitive it is as a value, so am being conservative).

I'm sure previously here it said "Nexus 5X" or something similar.

If I try to deploy to that device it fails, with an error saying:

Session 'mobile': Error Installing APK

No message appears on the phone, which definitely has USB Debugging enabled.

There's nothing in the Android Monitor tab, and the Event Log just shows:

21:42 Executing tasks: [:mobile:assembleDebug]

21:42 Gradle build finished in 661ms

21:42 Session 'mobile': Error Installing APK

I've tried updating Android Studio (I was previously on 2.3, and the same happened), restarting the phone and Android Studio. The app runs successfully in a Nexus 5X emulator.

I can't think of any other useful information that might be relevant, except that I'm connected USB-C to USB-C, but I'm pretty sure that was how I connected the phone before, I can try USB-A to USB-C tomorrow, but don't have that cable available right now. Any other thoughts?

3

There are 3 best solutions below

0
On

Plan A.

  1. You need to make sure the cord that is plugged into the computer is used for data transfer and not just for charging your device!

  2. Go to your phone's settings and make sure that the developer settings are turned on (my phone tends to turn this off randomly sometimes).

  3. If all else fails try the good ole' phone off and back on again.

Plan B.

  1. go to Run

  2. Click on Edit Configurations

  3. Select the project

  4. find the Target Device section under the General tab on the Android Application page.

0
On

Possible solutions:

  1. disable USB debugging and re-enable it again
  2. check the cable - if it's not the cable, connect the phone directly to the computer, without using any hub or anything

  3. stop adb deamon: adb kill-server, and then remove the .android directory in your home directory - this will remove the debug keys *

  4. removing your debug keys and restarting adb should make appear a confirmation dialog on your android device when you connect it

0
On

Adding a new answer, because although Adam Szewera and A. Petrizza's answers helped get me there, neither of them quite includes the key problem.

That was that I'd changed the 'Use USB to...' option, which appears as a notification when you plug the phone in to a computer to 'Charge this device'. Changing it to 'Transfer files' immediately fixed the problem, and now I see "LGE Nexus 5X ..." in Android Studio, and can deploy to it as before.

Thanks both for your pointers which got me thinking straight :)