Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,781,664 Members 42,521 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE] Lazyman's installation guide to ADB on Ubuntu 10.10 - Now with Ubuntu 11.10 !

Tip us?
 
bloodychaos
Old
(Last edited by bloodychaos; 24th December 2011 at 04:57 PM.) Reason: Updates for Ubuntu 11.10 installation
#1  
bloodychaos's Avatar
Member - OP
Thanks Meter 92
Posts: 58
Join Date: May 2010
Location: /home/kay/android-sdk-linux/
Default [GUIDE] Lazyman's installation guide to ADB on Ubuntu 10.10 - Now with Ubuntu 11.10 !

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. I will update the guide periodically for updates and other things. 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. From

Steps 1 to 4 and Steps 6 and 7, there's no differences in installation instructions for Ubuntu 11.04. You do have to take special note in Step 5 and the key difference of ADB working for your device in Ubuntu 11.04 is found here.

For Ubuntu 11.10, you can see the guide here. Credit goes to loveubuntu for making it.

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.

In Terminal, do the following

Code:
$ sudo add-apt-repository ppa:sun-java-community-team/sun-java6

$ sudo apt-get update

$ sudo apt-get install sun-java6-jre sun-java6-bin sun-java6-jdk
Edit: If you're getting a "404 Not Found" when trying to install java in Ubuntu 11.04, this link here will give you a quick fix.

Edit: If you want or need to use Eclipse, here's a simple installation command

Code:
$ sudo apt-get install eclipse ruby rubygems ruby-dev libxml2 libxml2-dev libxslt-dev openjdk-6-jdk ant git

$ sudo gem install nokogiri
Step 2. Download and Install Android SDK

Download the Android SDK. Obviously, choose the one for linux (android-sdk_rXX-linux_86.tgz), where "rXX" is the latest version.

Code:
http://developer.android.com/sdk/index.html
Extract the android-sdk-linux_x86 folder from android-sdk_rXX-linux_x86.tgz. Just double click the tgz file, and drag-n-drop the that lone folder to your desired location. In my case, I extracted the files to my Home Folder, which I highly recommend. I'll also advice to not renaming the folder.

Step 3. Choose packages to install

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

$ ./android update sdk
The 'Android SDK and AVD Manager' window will appear (screencap below). You can choose to accept all of them or just install all except for Android 1.5 and 1.6. 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

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

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

Code:
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.

Code:
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:

Code:
$ sudo gedit /etc/udev/rules.d/99-android.rules
For those using Ubuntu 10.10, use the following! For Ubuntu 11.04 users, please scroll down a little for 11.04 guide.

Ubuntu 10.10
Once the gedit window pops-up, type the following line.

Code:
SUBSYSTEM=="usb", ATTRS{idVendor}=="####", SYMLINK+="android_adb", MODE="0666" GROUP="plugdev"
Take note of ATTRS{idVendor}=="####". Replace #### to the correct Vendor ID of your device. If you're using Acer, then it's 0502, for HTC it's 0bb4. ADB might not be able to detect your device if you use the wrong ID. Here's a list of each vendor's ID. Source: http://developer.android.com/guide/d...ng/device.html

Code:
Manufacturer	USB Vendor ID
Acer		-0502
Dell 		-413c
Foxconn 	-0489
Garmin-Asus 	-091E
HTC 		-0bb4
Huawei 		-12d1
Kyocera 	-0482
LG 		-1004
Motorola 	-22b8
Nvidia 		-0955
Pantech 	-10A9
Samsung 	-04e8
Sharp 		-04dd
Sony Ericsson 	-0fce
ZTE 		-19D2
Save the file and exit out of gedit. Back in Terminal execute the following

Code:
$ sudo chmod a+rx /etc/udev/rules.d/99-android.rules

$ sudo restart udev
For Ubuntu 11.04. Special thanks to mmdl1001 for figuring this one out! Would've posted it earlier Ubuntu 11.04 was a little nasty on my PC for me to test it out. VMWare saved me though...

For Ubuntu 11.04 users, you'll need an 8 digit number, which is slightly different from Ubuntu 10.10. Copy and paste the following code in the 99-android.rules file you created

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}"
Next, you'll need to find the digits to replace "####:####' above. In terminal type
Code:
$ lsusb
You should be getting a list like so. Note that what is generated in your PC will be much different from mine below!
Code:
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 046d:c019 Logitech, Inc. Optical Tilt Wheel Mouse
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 010: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 007: ID 22b8:2d66 Motorola PCS
Look for your device. It's easily identifiable via its brand . In this case, "Bus 001 Device 007: ID 22b8:2d66 Motorola PCS" is for my device. Copy the ID numbers, 22b8:2d66 for my case, and replace the ####:#### in the 99-android.rules file. Save the file and close gedit and execute the following in Terminal.

Code:
$ sudo service udev restart
Now to check if it works

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

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

If that fails and still give you "???????????? no permissions", try restarting the adb server. That should do the trick. If that still doesn't work, check the file, 99-android.rules, that you created earlier. Most likely you have put in the wrong Vendor ID.

Code:
$ sudo adb kill-server

$ sudo nohup adb start-server
Step 6. Now to have fun!

Head down to Captainkrtek's ADB Workshop and Guide for everyone to learn how to use ADB. Take note that while using adb in Linux, you'll need to type ./adb to execute adb unless you create a path in bashrc. Go to Step 7 for that . For now, here are some examples on running adb if you don't create a path.

To get into the phone

Code:
kay@millelune-~/android-sdk-linux_x86/platform-tools:~$ ./adb shell
To grab files from phone

Code:
kay@millelune-~/android-sdk-linux_x86/platform-tools:~$ ./adb pull /system/etc/file.txt file.txt
To send file to phone

Code:
kay@millelune-~/android-sdk-linux_x86/platform-tools:~$ ./adb push this.txt /sdcard/this.txt
Also, do take note that when you pull a file, it will save itself in your android-sdk-linux_86 folder if no destination folder was given.

Step 7. Create path for ADB

Code:
$ sudo gedit ~/.bashrc
Add the following line at the very end of the file. Once you're done, save and exit.

Code:
# Android tools
export PATH=${PATH}:~/android-sdk-linux_x86/tools
export PATH=${PATH}:~/android-sdk-linux_x86/platform-tools
Now you can just run adb like it's a command.

Edit: Okay, for some odd reason, while the above worked for my desktop, it failed when I tried it on my notebook. If you tried to create a path but it failed, here's an alternative method

Code:
$ gedit ~/.profile
Once the gedit window pops up, scroll down to the very bottom of the file and add this line

Code:
[...]
PATH="$HOME/android-sdk-linux_x86/tools:$HOME/android-sdk-linux_x86/platform-tools:$PATH"
Once you've saved and closed gedit, run the following command in Terminal

Code:
export PATH="$HOME/android-sdk-linux_x86/tools:$HOME/android-sdk-linux_x86/platform-tools:$PATH"
And that's about it. Feel free to comment, give suggestions or ask questions if you're still unsure.

Also 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.
The Following 77 Users Say Thank You to bloodychaos For This Useful Post: [ Click to Expand ]
 
atapia984
Old
#2  
atapia984's Avatar
Senior Member
Thanks Meter 111
Posts: 524
Join Date: Aug 2010
Location: Chicago, IL
Took me about 10 mins to get this going. Thank you very much!

Phone - Samsung SPH-L710 ROM - CM10.1 Kernel - CM10.1
Tablet - HP TouchPad 16GB. ROM - webOS 3.0.5/CM10 Kernel - UberKernel/StockCM10
Don't forget to Thank your fellow XDA Members.
It is written Kernel not "Kernal".
The Following User Says Thank You to atapia984 For This Useful Post: [ Click to Expand ]
 
sykopompos
Old
#3  
sykopompos's Avatar
Senior Member
Thanks Meter 6,385
Posts: 6,313
Join Date: Jun 2008
Location: flithydelphia

 
DONATE TO ME
I have a guide to setup up a build enviroment for compiling android on a ubuntu 10.10 64bit or 32bit that covers adb also along with test signing. Just google guide to compiling android, covers cm7 and you will find it. It might be under gridlock32404 which was my old user name

Sent from my HTC Vision using XDA App
 
Nrre
Old
#4  
Senior Member
Thanks Meter 6
Posts: 232
Join Date: Jun 2009
ffffffffuuuuuuuu where was this last year? took me 2 days to get ADB working in Ubuntu 10.04 lol.

i do have the Ubuntu 10.10 ISO image...thinking about dual booting with win7 64bit.

not sure why i want to go back to Linux though...games ran slower on it =/
HIS: Evo3d , MeanROM ... yeah took me all 2 hours of use before I rooted it.

HERS: Evo4g, stock rom. She won't let me touch it :x
 
iceandfire
Old
#5  
iceandfire's Avatar
Recognized Developer
Thanks Meter 6,810
Posts: 1,748
Join Date: Nov 2010
Location: NCR

 
DONATE TO ME
Amazing work man. It works like a charm with my milestone.
 
godutch
Old
#6  
Senior Member
Thanks Meter 227
Posts: 1,870
Join Date: Jun 2009
nice tutorial but it would be even nicer to have a .deb; I never made debs before but I think this should all be doable with rpm though, so I guess it should also be doable with debs

(eg with a postinstall script update udev rules, using sed, restart abd and add a .desktop file)
 
rictec
Old
#7  
Senior Member
Thanks Meter 10
Posts: 305
Join Date: Jan 2005
Default saved a lot of do it myself

i was about to do this thank you for doing it first nice
 
donniezazen
Old
(Last edited by donniezazen; 5th March 2011 at 11:27 PM.)
#8  
donniezazen's Avatar
Senior Member
Thanks Meter 44
Posts: 902
Join Date: Jun 2010
Location: Salt Lake City

 
DONATE TO ME
I get following error when i try to refresh sources.
Quote:
Failed to fetch URL https://dl-ssl.google.com/android/re...repository.xml, reason: java.lang.RuntimeException: error instantiating default socket factory: java.security.KeyManagementException: java.security.KeyStoreException: java.io.FileNotFoundException: /usr/lib/jvm/java-1.5.0-gcj-4.4/jre/lib/security/cacerts (No such file or directory)
Edit:- I installed all packages like openjdk, openjre, icedtea etc and i was able to connect to google repo.
Attached Thumbnails
Click image for larger version

Name:	Refresh Sources _002.jpeg
Views:	1341
Size:	44.0 KB
ID:	534246  
 
aLeXiNDj
Old
#9  
aLeXiNDj's Avatar
Member
Thanks Meter 12
Posts: 62
Join Date: Jun 2010
Location: Guatemala

 
DONATE TO ME
thanks Im installed
 
bloodychaos
Old
#10  
bloodychaos's Avatar
Member - OP
Thanks Meter 92
Posts: 58
Join Date: May 2010
Location: /home/kay/android-sdk-linux/
Quote:
Originally Posted by atapia984 View Post
Took me about 10 mins to get this going. Thank you very much!
You're welcome! Honestly, it took me about 2 to 3 hours to get it running.

Quote:
Originally Posted by godutch View Post
nice tutorial but it would be even nicer to have a .deb; I never made debs before but I think this should all be doable with rpm though, so I guess it should also be doable with debs

(eg with a postinstall script update udev rules, using sed, restart abd and add a .desktop file)
Personally, I don't think a .deb file is required. Almost everything can be found in the repository anyways and it's quite easy to set up using terminal, and uh, I never really made debs before either

Main Device: Samsung Galaxy Note GT-N7000
Kernel: 3.0.32-CM-ge9cef6c
Memory Card: 32GB SanDisk MicroSDHC Class 10 (upgrading to 64GB microSDXC)

Test Device: HTC HD2
SPL: HSPL 2.08
Radio: 2.15.50.14
Bootloader: MAGLDR 1.13
NAND Build:
Memory Card: 8GB Transcend MicroSDHC Class 2 Partitioned to 6GB FAT32 & 2GB ext4[/FONT]

Extra stuff:
[GUIDE] Lazyman's installation guide to ADB on Ubuntu 10.10 - Now with Ubuntu 11.10!

The Following User Says Thank You to bloodychaos For This Useful Post: [ Click to Expand ]
Tags
adb, eclipse, guide, ubuntu
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes