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

Search This thread

BombaMyte

Senior Member
Nov 14, 2007
290
12
Stewartsville
@BreakingTheCycle: I've already set up my SDK and whatnot, but I can reinstall Ubuntu 9.10, and try this method. TBH, I used bits and pieces of several SDK installation tutorials to get it up and running. Hopefully this method will work. I'll try it after the game, about 30 mins...

EDIT: Okay, I followed the directions listed. Once you get to setting up the partition, I get that same error. So instead of naming the partition /AndroidSDK, I just selected "/" from the drop-down menu. Installation continues, yada-yada-yada, open Terminal, adb shell, success.
 
Last edited:

Breakthecycle2

Senior Member
Jun 7, 2009
2,561
9
NJ
@BreakingTheCycle: I've already set up my SDK and whatnot, but I can reinstall Ubuntu 9.10, and try this method. TBH, I used bits and pieces of several SDK installation tutorials to get it up and running. Hopefully this method will work. I'll try it after the game, about 30 mins...

EDIT: Okay, I followed the directions listed. Once you get to setting up the partition, I get that same error. So instead of naming the partition /AndroidSDK, I just selected "/" from the drop-down menu. Installation continues, yada-yada-yada, open Terminal, adb shell, success.

Hey man. OK, so I was able to delete the partition and install a fresh copy of 9.10. I followed the OP, installed rule 51 and did everything else. Now it still is saying adb is not a recognized command. My question is, does the sdk folder have to be in your filesystem folder or can it be be on the desk top? I would assume it's similar to windows and has to be on the root of your hard drive?
 

BombaMyte

Senior Member
Nov 14, 2007
290
12
Stewartsville
I moved mine from /home/bombamyte/ to the filesystem. Did you also edit your .bashrc for ADB access? I did this in stride with the OP, then changed it when I moved the SDK to the filesystem.
 

chrisharang

Member
Mar 26, 2009
44
0
I am running Ubuntu Jaunty 64-bit and I have an HTC Magic. I could get fastboot to work but I could not get adb to ever detect the device.

Finally, last night I found some additional rules that needed to be added to the android-rules files that did the trick! Also, in the time I was fiddling with it, I renamed my file 90-anroid-rules on someone's advice, I don't know if that is necessary but it is working for me so I am leaving it alone :)

So, the contents of my /etc/udev/rules.d/90-android-rules files is:
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb",ATTR{idVendor}=="0bb4",ATTR{idProduct}=="0c02",SYMLINK+="android_adb"
SUBSYSTEM=="usb",ATTR{idVendor}=="0bb4",ATTR{idProduct}=="0c01",SYMLINK+="android_fastboot"

I hope this helps some get adb to detect your device!

Thank you for this! I was having trouble getting a VM with Karmic (9.10) to recognize it with the usual settings, but this fixed it.

- Chris
 

Breakthecycle2

Senior Member
Jun 7, 2009
2,561
9
NJ
Ok, so I added rule 51, did all the steps for 9.10 needed. I have the sdk file in my home folder. I have tried everything and still cannot get adb to be recognized. It's runs fine on my vista partition, but not for ubuntu. Any ideas at all?
 

Breakthecycle2

Senior Member
Jun 7, 2009
2,561
9
NJ
Is my .bashrc file correct?

#AndroidDev PATH
export PATH=${PATH}:/AndroidSDK/tools

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
 

Breakthecycle2

Senior Member
Jun 7, 2009
2,561
9
NJ
Is my .bashrc file correct?

#AndroidDev PATH
export PATH=${PATH}:/AndroidSDK/tools

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi

Anyone? lol
 

BombaMyte

Senior Member
Nov 14, 2007
290
12
Stewartsville
I'll check mine against yours... Hang tight...

EDIT: Put...
Code:
#AndroidDev PATH
export PATH=${PATH}:/AndroidSDK/tools
after...
Code:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
so it looks like...
Code:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

#AndroidDev PATH
export PATH=${PATH}:/AndroidSDK/tools
Try that; that's how I have mine set up.
 
Last edited:

chrisharang

Member
Mar 26, 2009
44
0
Ok, so I added rule 51, did all the steps for 9.10 needed. I have the sdk file in my home folder. I have tried everything and still cannot get adb to be recognized. It's runs fine on my vista partition, but not for ubuntu. Any ideas at all?

Do you mean that adb isn't recognizing your G1, or that adb isn't found in your path at all?

- Chris
 

joe v

Senior Member
Feb 22, 2009
145
0
The only way I was able to set. Up 9.10 was to remove the. # AndroidDdev Path" out of and just leave this. export PATH=$PATH:/AndroidSDK/tools/ its on the op's 1st page lol. Just change the /AndroidSDK/tools/ path to were your sdk path is ...


P.s. I also had to use sdk r2,r3 would not work for me..
 
Last edited:

bmt626

Senior Member
Jul 23, 2009
115
73
This is what worked for me

#AndroidDev PATH

PATH="AndroidSDK/tools:$PATH"

i can now use my adb and autosign commands from anywhere
 

Ekril

Senior Member
Mar 8, 2008
543
147
Sibenik
Well,
thanks for the how to.

does anyone know how to find the vendor id for samsung galaxy device?

i would love to use a custom rom but i do not want to go to windoz.

thanks..

Ekrem
 

qakgob

Senior Member
Oct 16, 2009
64
1
Canterbury
Terminal error

I followed the instructions on the first page. However, when I start terminal I get this message at the top
Code:
bash: /home/qakgob/.bashrc: line 6: syntax error near unexpected token `('
bash: /home/qakgob/.bashrc: line 6: `export PATH=${PATH}:/home/qakgob/AndroidSDK/tools# ~/.bashrc: executed by bash(1) for non-login shells.'
and then if I try to run and comand (eg fastboot devices) I get the error
Code:
bash: fastboot: command not found
Any idea what I did wrong?
 

nicknowsky

Senior Member
Jan 9, 2008
721
24
Xiaomi Poco X3 NFC
Moto E (2020)
Its funny I installed a ubuntu distro SuperOS few days ago, I figures cause it Linux, and Android is open source also, its developed on LINUX that it would sync and work together nicely. But I found it to be a pain in the butt to get the SDK installed and be able to push apps in, and whatever else. This is a good little to have!!
 

liam.lah

Senior Member
Feb 12, 2010
653
31
Nevada
I can't get this to work with my nexus one. Fastboot works and detects my device, with some tweaking i got it to recognise adb, but adb wont find the device. This is my .bashsrc
(androidSDK is lowercase as is the actual folder)


Code:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

#AndroidDev PATH
PATH="androidSDK/tools:$PATH"


Example from terminal
Code:
user@sandbox:~$ fastboot devices
HT9CPP807263	fastboot
user@sandbox:~$ adb devices
List of devices attached 

user@sandbox:~$

Anything else you want to see?
I am running on karmic, not jaunty. Fresh install, no updates.


This is my only hope as windows refuses to even recognise the device anymore so i cant even install drivers for it.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 12
    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:
        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.
    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
      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.
    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!!! :O
    If you are having problems, send me a PM. I will be happy to help.
    2
    Can anybody mirror the fastboot binary?

    Nevermind! I had a backup!

    Multiple mirrors: http://www.multiupload.com/3580DBE6YE