Android operating system is the most versatile and powerful mobile OS platform so far and the reason behind is simple – a huge developer network. Being an open source platform, development on Android is a breeze and one can explore even the hardware level functions of the device. Development flexibility on this scale is missing in iOS and Windows niche because of their proprietary nature which restricts developers from exploring and tweaking. Many developers across the world strive for the improvement of the OS as well as the development for individual devices which brings many mods and ROMs to the Android users.

Being a Linux based platform, many Android developers use Linux based PC’s for the development which as you can realize, is the worst nightmare for beginners. Most beginners struggle to get their device detected by the PC which is the first step in the process of development. Without a proper connection with the device, one cannot carry on live debugging and tests on smartphones. So, you need to install proper USB drivers and setup Android SDK to obtain ADB tools and development kit which is used for the Android development.

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

In this tutorial, we will show you how to setup Android SDK on Ubuntu and setup ADB/USB drivers compatible with your Android device. The process involves playing with a few Linux commands but you don’t need to have a prior knowledge of these as we laid them quite simply. However, we request you to understand the process for knowledge purpose which will improve your understanding towards Android development. Follow the tutorial carefully and avoid typos unless you want to face a lot of errors in the process. So, let’s jump into the tutorial without any further ado

Prepare your Device

Make sure to use a proper USB cable while connecting to your PC as faulty cables might not show your device on the PC.

Enable USB Debugging on your phone from Settings> Developer options. If you do not find Developer option under device settings, read the instructions given here.

How to Setup ADB/USB drivers on Ubuntu

Part 1: Installing SDK and ADB

Download the latest Android SDK from the Google’s developers page → Click Here At the time of writing this tutorial, the SDK version is r24.0.2. So, we will use the SDK file name as android-sdk_r24.0.2-linux.tgz in this tutorial for convenience, you must change the name to the version you have downloaded. Extract the downloaded tgz package to your profile directory which will be /home/your-username. To do this, follow the below instructions: First, navigate to the the home directory of your profile. Execute the following command in the command terminal (Modify it with your username): cd /home/your-username

Now run the following command to extract the tgz package (Replace file name with the version you have downloaded): tar -xvzf android-sdk_r24.0.2-linux.tgz Don’t close the command terminal yet. Navigate to the tools folder of the SDK package 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/ directory if you have continued in the same terminal as in step 3. Finally run the following command to launch the Android SDK manager: ./android This will open a GUI based Android SDK manager. Download the necessary packages from the tool. To run ADB commands, you need to edit the bashrc file to add the ADB path in the environment variables of your PC. To edit the bashrc file, use the following command (You can use any editor) sudo gedit .bashrc Using sudo command may ask for the Linux password, enter your user password. This will allow you to operate the command with superuser permissions for a short time as specified in the sudoers file. The previous command will open the bashrc file in the GNU editor, add the following lines at the end of the file and save it. export PATH=${PATH}:~/android-sdk-linux/tools export PATH=${PATH}:~/android-sdk-linux/platform-tools

This completes the SDK and ADB installation on your Ubuntu based PC. Now follow the below instructions to install USB drivers for your Android smartphone on your PC. Part 2: Installing USB drivers for your device

Create an empty file in the /etc/udev/rules.d/ directory with the following name: If you’re using the Ubuntu version Gusty/Hardy/Dapper, create the file with the name 50-android.rules. Execute the following command to do so: sudo gedit /etc/udev/rules.d/50-android.rules

Execute the following command to do so: If you’re using the Ubuntu version Karmic Koala/Lucid Lynx/Maverick Meerkat, create the file with the name 70-android.rules. Execute the following command to do so: sudo gedit /etc/udev/rules.d/70-android.rules Type the following content in the editor and save it. For Gusty/Hardy: SUBSYSTEM==”usb”, SYSFS{idVendor}==”USB-VENDOR-ID”, MODE=”0666″

SUBSYSTEM==”usb”, SYSFS{idVendor}==”USB-VENDOR-ID”, MODE=”0666″ For Dapper: SUBSYSTEM==”usb_device”, SYSFS{idVendor}==”USB-VENDOR-ID”, MODE=”0666″

SUBSYSTEM==”usb_device”, SYSFS{idVendor}==”USB-VENDOR-ID”, MODE=”0666″ For Karmic Koala: SUBSYSTEM==”usb”, SYSFS{idVendor}==”USB-VENDOR-ID”, MODE=”0666″

SUBSYSTEM==”usb”, SYSFS{idVendor}==”USB-VENDOR-ID”, MODE=”0666″ For Lucid Lynx: SUBSYSTEM==”usb”, SYSFS{idVendor}==”USB-VENDOR-ID”, MODE=”0666″

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 USB vendor ID of your device. You can get it from the table below: Manufacturer USB Vendor ID Acer 0502 Dell 413c Foxconn 0489 Garmin-Asus 091E HTC (Older Phones) 0bb4 HTC (Newer phones) 18d1 Huawei 12d1 Kyocera 0482 LG 1004 Motorola 22b8 Nexus One/S 18d1 Nvidia 0955 Pantech 10A9 Samsung 04e8 Sharp 04dd Sony Ericsson 0fce ZTE 19D2 Now you have to append read permissions to the created file for all the profiles in the PC. Use one of the following command 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 Reboot your PC for the changes to take place.

That’s it. You have successfully installed ADB and USB drivers on your Ubuntu PC. Now connect your device to the PC using an USB cable and execute the following command in the terminal to test whether the device is detected by your PC or not.

adb devices

If your 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

Feel free to ask any queries in the comments section below.