Remove All Ads from XDA
Find Your Device:
Or Continue to Thread: [FAQ] GT540 Reference Thread |…
13th April 2011, 11:27 PM |#2  
lavero.burgos's Avatar
OP Senior Member
Flag Guayaquil
Thanks Meter: 1,360
Donate to Me
Question [HOW-TO] Set up SDK/ADB/FASTBOOT on Ubuntu 11.04

THANKS TO bloodychaos FROM XDA

I've been searching around the forums,the stickies and Google on how to install ADB in Ubuntu from scratch but I wasn't able to get a guide anywhere. What I found mostly are for Windows or little bits and pieces of info which did not cover the whole thing. Which is when I decided to grab some Tab and Mountain Dew, and Google my way through to make it work and share it to those who had trouble or no idea how to install it on Ubuntu.

When I'm writing this, I'm using Ubuntu 10.10 64bit to install and run everything. There was mentions of using Eclipse SDK while searching around, but I won't be touching on that. There's another guide for it at the end of my guide. I have yet to encounter any problems while using ADB in 64bit environment. I've tested it out on the 32bit platform as well and it works. It'll also work on SD and NAND versions of Android for the HD2, since it's my main phone. Also, this is my first time making a guide, so bear with me if there's any mistakes. I've checked the article a few times hoping that it's clear and easy to understand.

Step 1. Install JDK

You'll need to install JDK for ADB to work. If you have already installed JDK, I recommend reinstalling it again, just in case there are new updates or you have the older version.

Open Terminal and enter the following command(s), then enter your ubuntu login password followed by y when prompted for yes/no.

$ sudo apt-get update

$ sudo apt-get install openjdk-6-jdk
Step 2. Download and Install Android SDK

Download the Android SDK. Obviously, choose the one for linux (android-sdk_r10-linux_86.tgz)

Extract the android-sdk-linux_x86 folder from android-sdk_r10-linux_x86.tgz and put folder to your desired location. I recommend to put in home/username/ | When using the terminal the same path is described as ~/

Step 3. Choose packages to install

First of all go to ~/android-sdk-linux_x86/tools/
Right clic to android >> Properties >> Permissions
Make sure "allow executing file as a program" it's checked

In Terminal, type the following
$ cd ~/android-sdk-linux_x86/tools

$ ./android update sdk
The 'Android SDK and AVD Manager' window will appear (screencap below). If you are not a developer then just accept the first option to install and the rest reject. Once installation is finished, it will prompt you to restart the manager. Just click 'Yes' and close the manager

Step 4. Check your device's permission

Now head over to the platform-tools directory

$ cd ~/android-sdk-linux_x86/platform-tools
Check if you have permission for your device

$ ./adb devices
If you're getting the following, go on to Step 5.

List of devices attached
????????????    no permissions
If you're getting something like this or other random numbers with the word device next to it, congrats! You now could use ADB. Now go on to Step 7.

List of devices attached
0123456789ABCDEF    device
Step 5. Giving permission to your device

You'll need to create a certain udev rule. First off type the following in Terminal:

$ sudo gedit /etc/udev/rules.d/99-android.rules
Once the gedit window pops-up, type the following line

SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
Here's a list of each vendor's ID. Source:

Save the file and exit out of gedit. Back in Terminal execute the following

$ sudo chmod a+rx /etc/udev/rules.d/99-android.rules
$ sudo restart udev
$ sudo adb kill-server
Then unplug your phone and plug it again
Now to check if it works

$ ./adb devices
You should be getting the following line or something similar:

List of devices attached
0123456789ABCDEF    device
Congrats! Now you can use ADB in Ubuntu! Now hop on to Step 6!

Step 6. Create path for ADB and Fastboot

NOTE: while using adb in Linux, you'll need to type ./adb to execute adb unless you create a path in ~/.bashrc.
$ sudo gedit ~/.bashrc
Add the following line at the very end of the file. Once you're done, save and exit.

# Android tools
export PATH=${PATH}:$HOME"/android-sdk-linux_x86/tools"
export PATH=${PATH}:$HOME"/android-sdk-linux_x86/platform-tools"
Then in a Terminal run this command to reload your .bashrc:
source ~/.bashrc
Now you can just run adb without put ./ before every command.

Step 7. Set up FASTBOOT

Download Fastboot file from here:

Move it to ~/android-sdk-linux_x86/tools/ folder
Right clic to Fastboot >> Properties >> Permissions
Make sure "allow executing file as a program" it's checked

Reboot in fastboot mode (bootloader), then plug your phone with USB cable to a computer
Open a terminal and type:

$ sudo -s
# fastboot devices
0123456789ABCDEF fastboot
NOTE: you must login as root to fastboot to work. If you get an error issuing the last command then most likely something went wrong while creating a path for fastboot in ~/.bashrc, then you should try with ./ statement before the command like this:

# ./fastboot devices
0123456789ABCDEF fastboot

* For more in-depth guide, try HowtoForge. Just found this guide today and I find it VERY useful and even have a good guide on Eclipse.
Last edited by lavero.burgos; 26th June 2011 at 08:57 PM.
The Following 4 Users Say Thank You to lavero.burgos For This Useful Post: [ View ] Gift lavero.burgos Ad-Free