8

I'm unable to get my Nexus 4 phone recognized by ADB on Ubuntu (12.04 with a newer kernel installed: 3.8.0-30-generic). Developer mode is enabled on the phone.

The device shows up in lsusb:

$ lsusb
...
Bus 003 Device 034: ID 18d1:4ee5 Google Inc. 
...

But when I run adb devices I get an empty list. I found many posts on the internet about this problem but none of them solves the problem. There are two solutions.

  • Add a rule to /etc/udev/rules.d/51-android.rules. I found various variation for the content of this file. In most cases a idVendor and idProduct value should be set based on the output of lsusb. Below are some examples that I tried
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4ee5", MODE="0666" GROUP="androiddev", SYMLINK+="android%n"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", SYMLINK+="android_adb", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee5", MODE="0666", OWNER="my-login" 

After adding this I set the permissions for the rule file to 644 and I rebooted PC/ restarted udev, restarted phone and plugged in my Nexus 4.

  • Add the vendor id to ~/.android/adb_usb.ini.
echo 0x18d1 >> ~/.android/adb_usb.ini

I ran adb devices as root and normal user but I only get an empty list:

$ adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 

Any ideas on how to solve this problem? Any help of suggestions would be greatly appreciated.

0

4 Answers 4

7

It's not enough to make the Developer options page appear in the settings menu (by repeatedly tapping the build number). On that page, there's an option USB debugging, which defaults to off.

When USB Debugging is enabled, connecting your device to a PC using USB makes the "USB debugging connected" notification appear, regardless of whether adb is currently running on the PC.

3
  • Could you please detail your answer? Where can find this "page"? Commented Mar 20, 2016 at 17:05
  • @LuísdeSousa android.stackexchange.com/q/33496/12442
    – Dan Hulme
    Commented Mar 20, 2016 at 22:31
  • I am trying to connect through adb because the touch screen is broken. I have no means to access any of its menus and applications. Would there be any other way of activating this USB debugging feature? Commented Mar 21, 2016 at 13:53
1

For a more complete instruction set of how to get the Nexus 4 udev rules on ubuntu configured follow these instructions:

How to find your device Vendor ID

You can find a Vendor ID for usb connected devices with the following linux command:

lsusb

This will generate a list of all connected USB devices so make sure your device is connected before you do so.

Bus 001 Device 004: ID 18d1:4ee2 Google Inc.

The first part of the field after ID is the vendor ID (18d1) and the second part corresponds to the mode in which the device is connected. In this case 4ee2 equals MTP mode with debug on.

CREATE UDEV RULE FOR NEXUS 4

To be able to detect the Nexus 4 phone under Ubuntu, first thing is to create the proper udev rules that will allow the system to detect the phone.

These udev rules should be able to handle 4 different cases:

  • phone connected in MTP mode (USB debug on or off)
  • phone connected in PTP mode (USB debug on or off)
  • phone connected in Fastboot mode
  • phone connected in Recovery mode

They will be declared in /etc/udev/rules.d/99-android.rules. If file already exists, just append the content at the end of it.

# sudo gedit /etc/udev/rules.d/99-android.rules

Below contents has to be added. Make sure to replace the your-login field with your proper username your logged in with.

# Google Nexus 4 16 Gb
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee1", MODE="0666", OWNER="your-login" # MTP media (multimedia device)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0666", OWNER="your-login" # MTP media with USB debug on(multimedia device)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee5", MODE="0666", OWNER="your-login" # PTP media (camera)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee6", MODE="0666", OWNER="your-login" # PTP media with USB debug on (camera)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0666", OWNER="your-login" # Bootloader
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d001", MODE="0666", OWNER="your-login" # Recovery

Restart services

Once done, udev service has to be restarted.

# sudo service udev restart

Note that in some cases it's also needed to restart adb with:

adb kill-server
adb start-server

Or completely reboot the system with:

sudo reboot -n

Reconnecting the USB cable (instead of a reboot) might also work.

Authorize ADB connection

If you have just enabled the ADB debug option on your phone and created this new connection the ADB command might list your device as unauthorized. Just check the screen of your phone then to authorize the new connection.

Credits

Most of this information was found at http://bernaerts.dyndns.org/android/267-android-nexus4-root-twrp-ubuntu . This is a rooting guide for nexus 4 on ubuntu. I only used the first step of this guide.

3
  • I just tried this solution from Ubuntu 14.04 and even after rebooting the system the Nexus 4 is not recognised. Commented Mar 20, 2016 at 17:02
  • Did you try starting adb with root permissions? See one of the other replies about Ubuntu 14.04 + did you check the USB connection mode on the device? Commented Mar 21, 2016 at 5:13
  • Yes, I tried it with sudo. The phone gets connected in MTP mode with debug off. Commented Mar 21, 2016 at 13:49
1

I'm running Ubuntu 14.04 LTS and I've found that I have to run adb with root permissions for it to detect my phone. Just now I ran (from the platform-tools directory) ./adb devices and came up with an empty list. I restarted adb as root by running ./adb kill-server and then sudo ./adb start-server. Now adb devices returns:

List of devices attached 
01d17087d29dec60    device

Whereas before it looked like this:

List of devices attached

2
  • killing, then starting as root worked for me. Using a Nexus 5 Commented Jul 30, 2015 at 11:49
  • 1
    I just tried this solution on Ubuntu 14.04 and I still get an empty device list. Commented Mar 20, 2016 at 16:53
0

FYI: I recently updated the android version from 4.4 to 5.0 on my phone and ADB would no longer show the device as connected. It seems where USB connection method MTP was correct before it now has to be PTP.

2
  • Could you please detail your answer? Where exactly should this method be tweaked? Commented Mar 20, 2016 at 17:04
  • As I stated MTP was correct BEFORE, AFTER the update PTP was correct.
    – flowtron
    Commented Mar 22, 2016 at 21:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .