Android adb: device/smartphone not found (Ubuntu)

If you open the terminal, type adb devices and your smartphone is not found, here is the solution.
This was tested with Ubuntu 16.04. If you do not like the "vi" editor use "nano" or any other editor.

  • Make sure your phone has usb debugging enabled:
    https://www.ullright.org/ullWiki/show/android-enable-usb-debugging-for-adb
  • Connect your phone via usb
  • Type lsusb and you get a long list with all usb devices like this
    • Bus 004 Device 062: ID 0451:8025 Texas Instruments, Inc.
      Bus 004 Device 061: ID 0451:8140 Texas Instruments, Inc.
      Bus 004 Device 003: ID 0bda:8153 Realtek Semiconductor Corp.
      Bus 001 Device 064: ID 0fce:51f4 Sony Ericsson Mobile Communications AB
      Bus 004 Device 002: ID 2109:0817 VIA Labs, Inc.

  • Look for your phone device and note the vendor and product id (e.g. 0fce:51f4)
    The vendor id are the for charcters before the colon, the device id are the four letters after the colon.

  • Unplug phone
  • sudo vi /etc/udev/rules.d/51-android.rules
    • # Standard entry e.g. for Sony Xperia
      # Replace the vendor and product id with your device ids from above
      ATTR{idVendor}=="0fce", ATTR{idProduct}=="01f4", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
      
      # Alternative entry if the one above does not work e.g. for Nokia 5.1
      # Again replace the vendor and product id with your device ids from above
      # but also replace "klemens" with your linux username
      SUBSYSTEMS=="usb", ATTRS{idVendor}=="2e04", ATTRS{idProduct}=="c026", MODE="0666" GROUP="klemens", SYMLINK+="android%n"
  • sudo service udev restart
  • sudo adb kill-server && sudo adb start-server
  • Replug phone and select USB function "data/file access"
  • adb devices
    • Your device should show up now. If not proceed below

Additional Configuration

  • echo "0x<your device's vendor id>" > ~/.android/adb_usb.ini
  • Example for Nokia 5.1
    • echo "0x2e04" > ~/.android/adb_usb.ini
  • sudo adb kill-server && sudo adb start-server
  • Replug phone and select USB function "data/file access"
  • adb devices
    • Your device should show up now.