5,593,401 Members 36,360 Now Online
XDA Developers Android and Mobile Development Forum

[HOW-TO]Set up Android SDK/ADB/Fastboot on Ubuntu Linux

Tip us?
 
wddglr
Old
(Last edited by wddglr; 22nd September 2009 at 01:12 AM.)
#1  
wddglr's Avatar
Member - OP
Thanks Meter 17
Posts: 77
Join Date: Jan 2009
Location: El Paso, TX
Default [HOW-TO]Set up Android SDK/ADB/Fastboot on Ubuntu Linux

When I first attempted to install the SDK, I found tutorials that only had bits and pieces about the whole procedure. A lot of Google searches and hours of eye strain. I wanted to write a solid tutorial, but instead of publishing it in a personal blog, I chose to publish it here on xda-developers. This is the definite forum to come to if you are interested in Android/G1/HTC Dream development or costumization. I wrote this to make the enlarge the knowledge of this community.


!! THIS TUTORIAL IS FOR THE LATEST UBUNTU RELEASE: JAUNTY JACKALOPE 9.04 !!

!!START -------------------------------------- Optional Preparation --------------------------------------

This applies if you -
  • Are interested in installing Ubuntu for the first time.
  • Are/will be reinstalling Ubuntu from scratch.
  • Want to keep your SDK installation easy to reach.
  • Want to keep things nice and clean.
And your machine -
  • Has a second hard drive.
  • Has free space for another small partition.
This procedure will make things easier during installation of the SDK and in the long run. Hopefully you've read about partitions. If you are dualbooting, please read this first to get an idea of what you're doing.
  1. While installing Ubuntu and on the Prepare Disk Space screen (partition editor), select "Specify partitions manually (Advanced)"
  2. On the Create Partition dialog, select the following options:
    • Type for the new partition: Primary
      or Logical if you're dualbooting and know what you are doing.
    • New partition size in megabytes: 5120MB (5GB) might work. BUT:
      Quote:
      Originally Posted by ccyrowski View Post
      It should be noted that if you ever plan on compiling kernels and/or cupcake ROM's you will NEED ubuntu8.04. You'll also need at least 10GB.
    • Location for the new partition: Beginning
    • Use as: Ext4 or Ext3
      Filesystem doesn't matter. (?)
    • Mount point: /AndroidSDK
      Enter this manually
  3. Complete Ubuntu installation as usual.

-------------------------------------- Optional Preparation -------------------------------------- END!!


You will now install the SDK.




!!START -------------------------------------- Installing Android SDK --------------------------------------


Installing the SDK is the easiest of all.

  1. Download the SDK.
    169.9 MB [http://developer.android.com/sdk/dow...x86-1.5_r3.zip]
  2. Right-click and select Extract Here.
  3. Move the contents of the android-sdk-linux_x86-1.5_r3 directory to your desired location.
    If you followed Optional Installation, move the contents to your /AndroidSDK directory in the root of your filesystem.
  4. Close directory window.
-------------------------------------- Installing Android SDK -------------------------------------- END!!



You will now set up your bashrc file and UDEV to recognize your HTC Device.



!!START -------------------------------------- ADB + FASTBOOT --------------------------------------

The Android Debug Bridge (adb) is one of the tools that will help you the most when you run into flashing problems or running shell commands directly from your machine. UDEV will not recognize your G1 out of the box, but we will configure it with some rules so it can connect.

We will work with /AndroidSDK as the location of your sdk. If this is not your setup, I think you're smart enough to figure it out.


Editing .bashrc file to use tools from /AndroidSDK/tools/ directory -
  1. Go to your home folder.
    Example: /home/wddglr/
  2. Press Control + H to view hidden files.
  3. Look for your .bashrc file and double click to open it with gedit.
  4. Add the following lines to the top of the file:
    Code:
    #AndroidDev PATH
    export PATH=${PATH}:/AndroidSDK/tools
    IMPORTANT NOTE
    Quote:
    Originally Posted by savethechicken View Post
    This is the way that I have my .bashrc file setup. For those having problems with it not recognizing the adb as a command try this...
    Code:
    export PATH=$PATH:/AndroidSDK/tools
    I removed the {} around ${PATH} and it is working if I had them on it would say that it didn't recognize the command. Removed them and all works well.

Setting up UDEV to recognize HTC Device -
  1. Type the following into a terminal (Applications > Accessories > Terminal):
    Code:
    gksudo gedit /etc/udev/rules.d/51-android.rules
  2. Now add the following line to the blank file:
    Code:
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
  3. Click save and close.
  4. To restart udev, open up a terminal and enter:
    Code:
    sudo /etc/init.d/udev restart

Setting up fastboot -
  1. Download this fastboot binary from http://android-dls.com.
    130.4 KB [http://android-dls.com/files/linux/fastboot]
  2. Once downloaded to your desktop, right click and select Properties.
  3. Navigate to the Permissions tab and configure the following option:
    Execute: [√] Allow executing file as program
  4. Click Close.
  5. Move the fastboot bianary to your /AndroidSDK/tools/ directory.
  6. Reboot.
-------------------------------------- ADB + FASTBOOT -------------------------------------- END!!
Now you can use adb and fastboot directly from any terminal. If you chose to do the Optional Preparation, you can now save your Eclipse Workspace and your downloaded/custom ROMs/Themes in this new /AndroidSDK directory keeping things easier to reach and safe from evil disk errors or other mishaps!!! :eek:
If you are having problems, send me a PM. I will be happy to help.
The Following 12 Users Say Thank You to wddglr For This Useful Post: [ Click to Expand ]
 
alritewhadeva
Old
#2  
Senior Member
Thanks Meter 12
Posts: 1,364
Join Date: Mar 2009
*applaudes* awesome. Should be added to helpful threads.
T-Mobile G1
Super D
Clockwork Mod Recovery
**A Big thanks goes out to all the Developers**
Need help? Ask for it! PM me or contact me on Gtalk - alritewhadeva@gmail.com

Follow me on Twitter!
 
phantasm714
Old
#3  
Member
Thanks Meter 0
Posts: 70
Join Date: Jul 2008
Location: PDX
very nice! perhaps add a "(How-To)" prefix to thread??
 
nicholasbithell
Old
#4  
Member
Thanks Meter 0
Posts: 93
Join Date: May 2009
Everything was going great in setting this up until I got to this part "gedit /etc/udev/rules.d/51-android.rules"

I cannot find "51-android.rules" inside of "rules.d"
Any thoughts>?
 
wddglr
Old
#5  
wddglr's Avatar
Member - OP
Thanks Meter 17
Posts: 77
Join Date: Jan 2009
Location: El Paso, TX
Quote:
Originally Posted by nicholasbithell View Post
Everything was going great in setting this up until I got to this part "gedit /etc/udev/rules.d/51-android.rules"

I cannot find "51-android.rules" inside of "rules.d"
Any thoughts>?
it does not exist, you will make it.
do the command as stated above.
Code:
gksu gedit /etc/udev/rules.d/51-android.rules
 
cynofox
Old
#6  
cynofox's Avatar
Junior Member
Thanks Meter 0
Posts: 6
Join Date: Jun 2008
Location: Houston
Default Damn you beat me to it!

I was just thinking earlier about doing this same "How-To" guide, I was surprise to see it posted just now.

Anyways, great job!
Samsung Galaxy S3 - SynergyRom r373
Samsung Galaxy Note 10.1 Redemption Rom v4.3.1
 
Z҉A҉L҉G҉O̚̕̚
Old
#7  
Z҉A҉L҉G҉O̚̕̚'s Avatar
Senior Member
Thanks Meter 1
Posts: 657
Join Date: Jul 2009
Location: Ft. Meade
Can someone sticky this thread. Now I have ADB & fastboot on my Win7, Ubuntu, and OS X Partition. Thank you wddglr.
In the Criminal Justice System of Gotham City the people are represented by three seperate, yet equally important groups. The police who investigate crime, the District Attorneys who prosecute the offenders, and the God damn Batman.
These are their stories.
 
jay22are
Old
#8  
Senior Member
Thanks Meter 0
Posts: 128
Join Date: Jun 2009
bravo...linux rocks even better now!...
Phone: T-Mobile G1
Theme: HERO by Nabz
ROM Build: Cyanogen's Mod 3.9.7
Recovery Menu: Cyanogen's Recovery 1.4
Radio: 2.22.19.26I
SPL: Haykuro's SPL
SDCard: 4GB Class 4 500EXT3 COMPCACHE W/ BACKUP AUTO SWAP
 
savethechicken
Old
(Last edited by savethechicken; 17th July 2009 at 06:44 PM.)
#9  
savethechicken's Avatar
Senior Member
Thanks Meter 0
Posts: 244
Join Date: Jan 2009
Location: Albuquerque
Awesome tutorial for setting this up. Have been using adb/sdk on ubuntu since oct. but this would have saved me some headaches back in the first couple of weeks.

The onlything that is not clear and/or confuses me is

Setting up the udev to recognize the device.

SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

Have never used this (will now to see if it will do anything) and the only problem i have is that sometimes i have to kill-server to get it to connect correctly but i have seen this happen to almost everyone on many forums since the 9.04 came out. And even after putting this file on the computer i have had the problem.
//\\HTC Sensation//\\
Android Revolution HD 6.5.1
 
wddglr
Old
#10  
wddglr's Avatar
Member - OP
Thanks Meter 17
Posts: 77
Join Date: Jan 2009
Location: El Paso, TX
Quote:
Originally Posted by savethechicken View Post
Awesome tutorial for setting this up. Have been using adb/sdk on ubuntu since oct. but this would have saved me some headaches back in the first couple of weeks.

The onlything that is not clear and/or confuses me is

Setting up the udev to recognize the device.

SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

Have never used this (will now to see if it will do anything) and the only problem i have is that sometimes i have to kill-server to get it to connect correctly but i have seen this happen to almost everyone on many forums since the 9.04 came out. And even after putting this file on the computer i have had the problem.
It happens to me also from time to time. especially when i reboot and want to go into adb while the device is rebooting. although that file, 51-adndroid.rules, is what helped me get adb to recognize the device. the guide on developer.android.com talked about 50-android.rules but after a few deep searches i found this: http://groups.google.com/group/andro...3488c601243686

Tags
sdk adb fastboot ubuntu
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Prevent Unwanted Butt Dialing with Smart Pocket Guard

You may recall that back in August of last year, we took a look atAir SwiperbyXDA … more

Google ATAP Details Project Ara in Developers’ Conference

Earlier today, the Google ATAP teamkicked offits first ever Project Ara … more

HTC Sense 6 Ported to the Nexus 5

The Google Nexus 5 is regarded as having everything an Android user needs or wants: timely updates, … more