These are instructions to install the Android SDK onto Ubuntu or really any Debian distro for that matter. If you are only interested in adb/fastboot and do not need or want the full sdk install, please see our forum's mini-sdk option for that instead. Otherwise, read on...
[Updated 6/29/16 for sdk revision 24.4.1]
Well, I just stumbled through this and it was much harder than I remembered in the past so I thought I'd share my findings in case it helps anybody. I found none of the existing guides to be totally correct so the following is information borrowed from several sources as well as my own experiences to finally get it working:
(All terminal commands in bold)
Open terminal and start with this command to download:
wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
Unpack:
tar -xzvf android-sdk_r24.4.1-linux.tgz
To make it work on a 64 bit machine (this was what finally made things work on my machine after a few failed previous attempts. Also note, this takes awhile, be patient):
sudo apt-get update
sudo apt-get install ia32-libs-multiarch
Install jdk (if not already installed on your machine):
sudo apt-get install openjdk-8-jdk
If you have plans to compile CM13 in particular, you may wish to also add a line to your bashrc since Ubuntu 16.x doesn't seem to play well with Java7 anymore:
sudo gedit ~/.bashrc
With your bashrc now open, add the following line to the end of the file, then save and exit...
Install the sdk:
cd ~/android-sdk-linux/tools
./android
The sdk manager window should now pop up. Choose packages you want, of course tools and platform-tools are required as always. I'm skipping the Eclipse install, sorry if you wanted that. Just trying to help people get tools/platform tools working in this guide.
Now plug in your phone to the usb port and type:
lsusb
This should kick out a list of plugged in devices. Most likely the last one is the phone. There were references to Samsung and Galaxy so it was pretty easy to figure out. On that same line, there is an ID number in this format...xxxx:xxxx. Write that number down for reference.
Now a few more commands:
cd
sudo gedit /etc/udev/rules.d/99-android.rules
When the rules open, go to the end and copy/paste the following:
Now, replace the ####:#### in the above string of text with the number you wrote down a few steps ago. Then save and exit.
Another command:
sudo service udev restart
Now check to see if you're good:
cd ~/android-sdk-linux/platform-tools
./adb devices
Watch your phone's screen at this time. If it's not on, turn it on and look for an RSA popup which authorizes your device to your PC. When you see the popup, check the box to "always allow", then hit ok.
For those who experience the dreaded ????? No Permissions error after running the adb devices command, try this now:
sudo ./adb kill-server
sudo ./adb start-server
sudo ./adb devices
(Remove the ./ from the above commands if your path is already set)
If you didn't experience the above problem, you should already be seeing the s/n now. If not, exit terminal, reopen and retry the above 2 commands. If all is well and you want to be able to adb/fastboot from any directory, you'll need to edit the bashrc like this:
sudo gedit ~/.bashrc
When the file window pops up, copy/paste the following at the end of the existing text, then save and exit:
Now unplug phone and reboot the machine. Once booted back up, plug phone back in and from any location run:
adb devices
If all went well, it'll output your s/n as before but without the ./ prefix and no need to execute from the platform-tools directory. If it worked, you are all set for adb usage.
However, I had issues with fastboot. When booting into the bootloader and running the fastboot devices command, I kept getting a "no permissions" error. The fix for this is to both edit and change permissions for /etc/udev/rules.d/51-android.rules. Rather than explain it all here, I am posting a link for this procedure that worked well for me:
pts.blog: How to fix the adb no permissions error on Ubuntu Lucid
After using that procedure, fastboot devices returned my device ID just fine and I had full adb & fastboot capabilities.
[Updated 6/29/16 for sdk revision 24.4.1]
Well, I just stumbled through this and it was much harder than I remembered in the past so I thought I'd share my findings in case it helps anybody. I found none of the existing guides to be totally correct so the following is information borrowed from several sources as well as my own experiences to finally get it working:
(All terminal commands in bold)
Open terminal and start with this command to download:
wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
Unpack:
tar -xzvf android-sdk_r24.4.1-linux.tgz
To make it work on a 64 bit machine (this was what finally made things work on my machine after a few failed previous attempts. Also note, this takes awhile, be patient):
sudo apt-get update
sudo apt-get install ia32-libs-multiarch
Install jdk (if not already installed on your machine):
sudo apt-get install openjdk-8-jdk
If you have plans to compile CM13 in particular, you may wish to also add a line to your bashrc since Ubuntu 16.x doesn't seem to play well with Java7 anymore:
sudo gedit ~/.bashrc
With your bashrc now open, add the following line to the end of the file, then save and exit...
Code:
export EXPERIMENTAL_USE_JAVA8=true
Install the sdk:
cd ~/android-sdk-linux/tools
./android
The sdk manager window should now pop up. Choose packages you want, of course tools and platform-tools are required as always. I'm skipping the Eclipse install, sorry if you wanted that. Just trying to help people get tools/platform tools working in this guide.
Now plug in your phone to the usb port and type:
lsusb
This should kick out a list of plugged in devices. Most likely the last one is the phone. There were references to Samsung and Galaxy so it was pretty easy to figure out. On that same line, there is an ID number in this format...xxxx:xxxx. Write that number down for reference.
Now a few more commands:
cd
sudo gedit /etc/udev/rules.d/99-android.rules
When the rules open, go to the end and copy/paste the following:
Code:
SUBSYSTEM=="usb", ATTRS{idVendor}=="####:####", SYMLINK+="android_adb", MODE="0666" GROUP="plugdev"TEST=="/var/run/ConsoleKit/database", \RUN+="udev-acl --action=$env{action} --device=$env{DEVNAME}"
Another command:
sudo service udev restart
Now check to see if you're good:
cd ~/android-sdk-linux/platform-tools
./adb devices
Watch your phone's screen at this time. If it's not on, turn it on and look for an RSA popup which authorizes your device to your PC. When you see the popup, check the box to "always allow", then hit ok.
For those who experience the dreaded ????? No Permissions error after running the adb devices command, try this now:
sudo ./adb kill-server
sudo ./adb start-server
sudo ./adb devices
(Remove the ./ from the above commands if your path is already set)
If you didn't experience the above problem, you should already be seeing the s/n now. If not, exit terminal, reopen and retry the above 2 commands. If all is well and you want to be able to adb/fastboot from any directory, you'll need to edit the bashrc like this:
sudo gedit ~/.bashrc
When the file window pops up, copy/paste the following at the end of the existing text, then save and exit:
Code:
# Android tools
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools
Now unplug phone and reboot the machine. Once booted back up, plug phone back in and from any location run:
adb devices
If all went well, it'll output your s/n as before but without the ./ prefix and no need to execute from the platform-tools directory. If it worked, you are all set for adb usage.
However, I had issues with fastboot. When booting into the bootloader and running the fastboot devices command, I kept getting a "no permissions" error. The fix for this is to both edit and change permissions for /etc/udev/rules.d/51-android.rules. Rather than explain it all here, I am posting a link for this procedure that worked well for me:
pts.blog: How to fix the adb no permissions error on Ubuntu Lucid
After using that procedure, fastboot devices returned my device ID just fine and I had full adb & fastboot capabilities.
Last edited: