# [GUIDE]Install Java, Android SDK, ADB, and Fastboot in Linux Ubuntu and Mint12



## loveubuntu

Update 3-3-2012: I just tried this on Ubuntu 12.04 Beta and Linux Mint 12 . It worked on both.

Thank you to the XDA original poster bloodychaos. I used some of his info/code and changed a few things to reflect new versions of Ubuntu/Android SDK.

OK I can confirm that the method for installing Android SDK and using ADB in the original post for Ubuntu 11.04 also works with the horrible looking, "unity" infested, Ubuntu 11.10 Oneiric Ocelot. There are some minor changes from the OP and how it will work with 11.10/11.04. Here are the steps I took to get ADB working like a charm. Again, all the credit goes to the original poster. I'm just reporting my experience using his method/advice:

***please make sure debugging is enabled on your phone: menu/settings/applications/development/check mark debugging to enable***

1-Install java by Sun(JDK). There are different ways of installing sun-java and one is mentioned in the original post. I've used my method often and it has worked for me quite well. Here it is:

method 1: I actually like this method best since you know what you are doing step by step.http://sites.google....ipsproject/java

This works in Linux Mint 12 also.

Method 2 (I'm still leaving this here but I strongly suggest you use method 1): If Synaptic is not acting weird (it does in 12.04 Beta), use this method. Since Ubuntu no loinger includes Synaptic, go to Ubuntu Software Center, search for it, check all the add-ons in the middle, apply the changes, once done, click install in the right hand corner. Once installed start the package manager (start typing synaptic in the dock's search) and click on it. Now click on settings/repositories. Click the "other software" tab and click ADD. Now in the APT line copy and paste this: ppa:ferramroberto/java

click add source and then add volume and close. When you are back in the Synaptic window, click reload. Once reloaded, in the quick filter field type java6. You will see some entries, you need to "right click" the box and choose mark for installation for 4 items: sun-java6-bin, sun-java6-jre, sun-java6-jdk, sun-java6-plugin. Click apply and now you should see the box next to those items as green. You are done with java.

2- Download and Install Android SDK (which has ADB included of course):

http://developer.and.../sdk/index.html

Click and download the Linux version. Go to your Download folder and "right" click the .tgz file and click extract here. Now you have a folder called android-sdk-linux. Cut it from this folder and paste it in the Home folder. Note that the most of the names have changed from the original post.

Fire up a terminal (search for terminal in the dock's search field) and change directory from Home (that terminal opens in) to android-sdk-linux/tools type:



Code:


cd android-sdk-linux/tools

( you can do it in one step like above or two steps, first cd into the android-sdk-linux then into tools)

Now update the sdk by typing:



Code:


./android update sdk

The update window and the sdk open up. By default, all platforms have been selected to be installed. This will take a very long time; so if you don't need all those platforms, only pick a few you need to install. I chose all and it took me a few hours. No harm to choose all but be warned, it takes for ever.

HTC and MOTO now want you to have a dev account. You can create one, it takes a few seconds for each. Once you enter your new login and password in the SDK update window once, you don't need to enter it for all their platforms.

3- make sure USB debugging box is checked on your phone, settings/applications/development. Now connect your phone. You DO NOT want to turn on USB storage and you should see the usb debugging connected message.

4- In the terminal type:



Code:


cd android-sdk-linux/platform-tools

to go to that folder. Now type:



Code:


./adb devices

If you see your device in something like this, you are done.



Code:


List of devices attached<br />
<br />
HT12HS005115	device

But I doubt it. I've never seen it work that easily. You have to give permission to your phone. While still connected to your phone, in the terminal type lsusb to get a list of all usb devices. Usually the last one is your phone. I didn't know HTC stood for High Tech Computer Corp so it took me a few seconds to locate it.  Now right down the 9 character (xxxx:xxxx) ID to the left of your phone.

In the terminal, type in cd then press enter to be at the ~$ prompt. Now type:



Code:


sudo gedit /etc/udev/rules.d/99-android.rules

to create a blank file and open it (you have to enter your root password every time you type sudo. You don't see anything being typed but it's there. If you are here reading this you already knew that though). In the file type (copy and paste of course):



Code:


SUBSYSTEM=="usb", ATTRS{idVendor}=="####:####", SYMLINK+="android_adb", MODE="0666" GROUP="plugdev"<br />
TEST=="/var/run/ConsoleKit/database", \<br />
RUN+="udev-acl --action=$env{action} --device=$env{DEVNAME}"

(thank you cainn24 for the typo correction)

now care fully replace the ####:#### with the 9 character you wrote down above. Save and exit.

Type:



Code:


sudo service udev restart

and press enter.

5- Now we need to test adb to see if it worked. In a terminal, type:



Code:


cd android-sdk-linux/platform-tools

to change to that directory. ADB is in there. Type in



Code:


./adb devices

If you see your device and it's serial number your done. If you don't (which I did not) stop and restart adb by using these commands while you are in that folder still:



Code:


./adb kill-server




Code:


./adb start-server

Now unplug your phone and replug it and tyoe:



Code:


./adb devices

You should now see your device and it's serial number.

6- To be able to use adb from any folder in the terminal and use it as a command (without the ./), do this: (creating a path)

In a terminal type: (it can be at any prompt)



Code:


sudo gedit ~/.bashrc

enter password and enter. A file opens up. You need to add the following at the end of the file: (again note that names have changed from the original post)



Code:


# Android tools<br />
export PATH=${PATH}:~/android-sdk-linux/tools<br />
export PATH=${PATH}:~/android-sdk-linux/platform-tools

save and exit. Make sure you are not adding or omitting anything or you will get an error. You need to restart your computer, kill adb and restart adb as above, and unplug/re-plug your phone to complete this step. Now press cd and enter to be at ~$ prompt. Lets see if adb works without being in that folder: type:



Code:


adb devices

if you get the same device name and serial number you got when you were in the adb directory, you are done. You can now run adb from anywhere as a command. If you don't, unplug and re-plug the phone, restart the terminal and should work.

Fastboot
update 02-22-12: It seems like Google has included fastboot in the platform-tools folder now. Before doing anything check and see if it's there. If it is, all you need to do is test it. Go to the last paragraph marked by *** in this section to test fastboot.

Setting up fastboot in Ubuntu 11.10: Now that you have adb setup, it's pretty easy to setup fastboot. The source of my knowledge for this is http://wiki.cyanogen...m/wiki/Fastboot

You may run into a guide that would ask you to use fastboot to accomplish something. So it's nice to have it handy when needed but don't be going around using commands you know nothing about. It may mess up your device.

For fastboot to work, you have to have S-OFF and be in the bootloader (fastboot menu). Remember, Bootloader/fastboot is not the same as the recovery menu. Unlike adb, nothing happens if you have your phone booted normally, you have to be in the fastboot menu. Now go to http://koushikdutta.blurryfox.com/G1/ and download the right version (Linux of course). Extract the zipped file and rename it fastboot for ease of use. Cut and paste it into your android-sdk-linux/platform-tools folder from the above settings. Because you set your path above to be able to issue commands from both tools and platform-tools folders, you are done. I chose the platform-tools since Google has moved adb from the tools folder to this folder. I read somewhere that they by mistake omitted fastboot from the latest version of Androiod SDK.

***Now to test it, turn your phone off and boot into the bootloader manually (each phone has different combo keys for this) or fire up a terminal and type:



Code:


adb reboot-bootloader

now type:



Code:


fastboot devices

and see if your device and serial number is recognized.


----------



## cowsquad

nice thread man. I always use this tutorial every time I want to install SDK AND JAVA.
thank you very much


----------



## Marshall33

running linuxmint 12...after installing the sdk and running it when i get to the end of the platform downloads i get this error message: Stopping ADB server failed (code 1). Unable to run 'adb': Cannot run program "/home/benjamin/android-sdk-linux/platform-tools/adb": error=2, No such file or directory. Starting ADB server failed (code 1).

Help please?


----------



## cowsquad

Marshall33 said:


> running linuxmint 12...after installing the sdk and running it when i get to the end of the platform downloads i get this error message: Stopping ADB server failed (code 1). Unable to run 'adb': Cannot run program "/home/benjamin/android-sdk-linux/platform-tools/adb": error=2, No such file or directory. Starting ADB server failed (code 1).
> 
> Help please?


navigate to that folder and make sure adb is there

Sent from my Galaxy Nexus using Tapatalk 2


----------



## Marshall33

cowsquad said:


> navigate to that folder and make sure adb is there
> 
> Sent from my Galaxy Nexus using Tapatalk 2


what do i do if it is not there and why wouldnt it be there? am i doing something wrong downloading the sdk, extracting it to my home folder, running it and installing platforms?


----------



## cowsquad

Marshall33 said:


> what do i do if it is not there and why wouldn't it be there? am i doing something wrong downloading the sdk, extracting it to my home folder, running it and installing platforms?


did you fix your issue already. You should redownload the platform tools off of sdk.

Sent from my Galaxy Nexus using Tapatalk 2


----------



## cowsquad

cowsquad said:


> did you fix your issue already. You redownload the platform tools off of sdk.
> Go to terminal emulator and navigate to you tools folders then launch up the sdk and click on android SDK platform-tools, delete that and reinstall it.
> Sent from my Galaxy Nexus using Tapatalk 2


Sent from my Galaxy Nexus using Tapatalk 2


----------



## Marshall33

cowsquad said:


> Sent from my Galaxy Nexus using Tapatalk 2


 I'll give that a shot this evening...Hope I can figure it out!

Sent from my Galaxy Nexus using Tapatalk 2


----------



## Marshall33

cowsquad said:


> Sent from my Galaxy Nexus using Tapatalk 2


Everytime I try to load the SDK platform tools from the sdk manager I'm getting the same "Stopping ADB server failed (code 1)" error message...Any ideas on a fix? bout ready to try Ubuntu again...11.04 maybe?

Edit: got it to work after "sudo apt-get install ia32 libs" thanks for the help.


----------



## cowsquad

Marshall33 said:


> Everytime I try to load the SDK platform tools from the sdk manager I'm getting the same "Stopping ADB server failed (code 1)" error message...Any ideas on a fix? bout ready to try Ubuntu again...11.04 maybe?
> 
> Edit: got it to work after "sudo apt-get install ia32 libs" thanks for the help.


omg I totally forgot about that. That's how I fixed mine too. Thank you too

Sent from my Galaxy Nexus using Tapatalk 2


----------



## Mace_Bewley

Fixing to give this a try!


----------



## randyrkelly

Worked like a charm except i had to install Openjre

Linux Mint 13


----------



## mikeric

I got to step 5 fine, and it detects my galaxy nexus. I was trying to get it to work on my rooted kindle fire with firefirefire bootloader but it wont detect it. Anyone have any device? I wanted to get fastboot to work so I could dual boot.


----------



## Sws06

Ive been through a lot of guides on getting adb to work with ubuntu, most are over my head though. This worked flawlessly for me  , Thanks for the great guide. On top of getting adb working... I can just type adb in a terminal window now instead of cd'ing to the tools dir and typing the ./, so exciting! Once again, thank you!


----------



## ynk3

I keep getting this error:

:~/android-sdk-linux/platform-tools$ ./adb devices
bash: ./adb: No such file or directory

i have checked in the tools folder and there is adb.exe there.


----------



## DeadmanIncJS

everything works until i get to the point where i can do the "sudo gedit ~/ .bashrc" part. it doesn't work


----------



## Maverick39

I'm having a problem it keeps telling me the devices is offline (FA2BNS503723 offline).


----------



## sabret00the

ynk3 said:


> I keep getting this error:
> 
> :~/android-sdk-linux/platform-tools$ ./adb devices
> bash: ./adb: No such file or directory
> 
> i have checked in the tools folder and there is adb.exe there.


It seems both adb and fastboot need to marked as executables.


----------

