How To Install ADB And USB Drivers On Ubuntu

1,139

The Android operating system is the most flexible and powerful mobile OS platform by far and the reason behind it is simple – a huge developer network. Being an open source platform, Android development is very easy and one can explore even hardware level functions. Development flexibility at this scale is missing on iOS and Windows due to their proprietary nature which restricts developers from exploring and customizing. Many developers around the world are trying to improve the OS as well as development for individual devices which brings a lot of mods and ROMs to Android users.

Being a Linux based platform, many Android developers use Linux based PCs for development as you are aware. Most of the beginners struggle to get their device detected by the PC which is the first step in the development process. Without proper connection with the device, one cannot perform live debugging and tests on the smartphone. So you need to install proper USB drivers and set up Android SDK to get ADB and development kit used for Android development.

The Android SDK is a development environment for the Android operating system that allows you to simulate apps and mods on the emulator and test them on live devices with intelligent debugging. Developers need to take proper logs during the test phase to understand and resolve errors during the process. For this you will need ADB and USB drivers that work on the PC. ADB stands for Android Debug Bridge which is a versatile command line tool that acts as a bridge between Android device and PC allowing data to be transferred.

In this tutorial, we will show you how to set up the Android SDK on Ubuntu and set up ADB/USB drivers compatible with Android devices. The process involves playing with some Linux commands but you don’t need to have any prior knowledge of these as we put them pretty simply. However, we ask you to understand the process for knowledge purposes which will improve your understanding of Android development. Follow the tutorial carefully and avoid mistakes. So, let’s get straight to the tutorial.

Set Up Device

  • Make sure to use the correct USB cable when connecting to the PC as a damaged cable may not display the device on the PC.
  • Enable  USB Debugging on the phone from Settings > Developer options. If you don’t find Developer options under device settings, read the instructions given here.

How To Set ADB/USB Driver In Ubuntu

Part 1: Installing SDK and ADB

  1. Download the latest Android SDK for Linux Click Here
  2. Extract the downloaded zip  package to your linux username directory which will be /home/your-username. To do this, follow the instructions below:
    • First, navigate to the home directory of the username. Run the following command in terminal (Change with your username):
      cd /home/your-username
    • Now run the following command to extract the zip package (Rename the file with the version you have downloaded):
      unzip platform-tools_r29.0.1-linux.zip

      Do not close the terminal.

  3. Navigate to the tools folder of the SDK package that you have extracted. To do this run the following command.
    cd ~/android-sdk-linux/tools

    Here,  ~ indicates the current directory which should be  /home/your-username/  if you have continued in the same terminal as in step 3.

  4. Finally run the following command to launch the Android SDK manager:
    ./android
  5. This will open a GUI based Android SDK manager. Download the required packages of this tool.
  6. To run ADB commands, you need to edit the  bashrc file to add ADB path in PC environment variables. To edit the bashrc file, use the following command (you can use any editor)
    sudo runs .bashrc

    Using the sudo command can ask for Linux password, enter your user password. This will allow you to operate commands with superuser permissions for a short time as specified in the sudoers file.

  7. The previous command will open the bashrc file in the GNU editor, add the following line at the end of the file and save.
    export PATH=${PATH}:~/android-sdk-linux/tools
    export PATH=${PATH}:~/android-sdk-linux/platform-tools

This will complete the SDK and ADB installation on the Ubuntu based PC. Now follow the instructions below to install USB driver for Android smartphone on PC.

Part 2: Installing the USB driver for the phone

  1. Create an empty file in the  /etc/udev/rules.d/  directory  with the following name:
    • If you are using the Ubuntu version of Gusty/Hardy/Dapper, create a file named 50-android.rules. Run the following command to do it:
      sudo gedit /etc/udev/rules.d/50-android.rules
    • If you are using the Karmic Koala/Lucid Lynx/Maverick Meerkat version of Ubuntu, create a file called  70-android.rules. Run the following command to do it:
      sudo gedit /etc/udev/rules.d/70-android.rules
  2. Type the following content in the editor and save it.
    • For Gusty/Hardy: SUBSYSTEM==”usb”, SYSFS{idVendor}==”USB-VENDOR-ID”, MODE=”0666″
    • For Dapper: SUBSYSTEM==”usb_device”, SYSFS{idVendor}==”USB-VENDOR-ID”, MODE=”0666″
    • For Karmic Koala: SUBSYSTEM==”usb”, SYSFS{idVendor}==”USB-VENDOR-ID”, MODE=”0666″
    • For Lucid Lynx: SUBSYSTEM==”usb”, SYSFS{idVendor}==”USB-VENDOR-ID”, MODE=”0666″
    • For Maverick Meerkat: SUBSYSTEM==”usb”, ATTR{idVendor}==”USB-VENDOR-ID”, MODE=”0666″

    Change the USB-VENDOR-ID string with the device’s USB vendor ID. You can get it from the table below:

    Pabrikan ID Vendor USB
    Acer 0502
    Dell 413c
    Foxconn 0489
    Garmin Asus 091E
    HTC (Ponsel Lama) 0bb4
    HTC (Ponsel yang lebih baru) 18d1
    Huawei 12d1
    Kyocera 0482
    LG 1004
    Motorola 22b8
    Nexus One / S 18d1
    Nvidia 0955
    Pantech 10A9
    Samsung 04e8
    Tajam 04d
    Sony Ericsson 0fce
    ZTE 19D2
  3. Now you have to add read permission to the file created for all profiles on PC. Use one of the following commands to do this:
    sudo chmod a+rx /etc/udev/rules.d/50-android.rules

    or

    sudo chmod a+rx /etc/udev/rules.d/70-android.rules
  4. Reboot the PC for the changes to take place.

You have successfully installed ADB and USB drivers on your Ubuntu PC. Now connect the device to the PC using a USB cable and run the following command in the terminal to test whether the device is detected by the PC or not.

adb devices

If the device is detected by the PC, you will see a serial number similar to the one below in the terminal.

List of devices attached V00776140945011 device

If you have any questions please leave them in the comments column below.

You might also like
Leave A Reply

Your email address will not be published.