[How To] Install Android SDK On Ubuntu 12.04 / 12.10
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:
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-6-jdk
Install the sdk: cd android-sdk-linux/tools
./android sdk
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
Should get the device s/n now. If not, exit, restart machine then open up terminal and retry the above 2 commands. If all is well and you want to be able to adb/fastboot globally, 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, restart machine. Once fired 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:
Device(s): Rooted Galaxy Nexus | Liquid ICS 1.35
Nook Color | ICS cm9 nightly kang
Carrier: Not Provided
Thanks: 64
Thanked 75 Times in 50 Posts
When I installed the asked on my Xubuntu machine, it literally took days. Parts and pieces didn't work right and most of what I did had no guidance or structure. I need to wipe and update my laptop, and I think I'll follow this guide for reinstall the sdk. Thanks.
I did not have to update my .bashrc, nor did I have to set rules, get phone ids or anything like that. All I did was to copy adb to my bin folder, and my adb worked like a charm. So before you go to all those steps, try to simply copy adb to the bin folder.
Thanks for this guide though. I am just adding my 2 cents :-)
Good to know. I'll definitely give that a shot next time. And that allows you to run adb and fastboot from anywhere along with automatic device recognition?
Good to know. I'll definitely give that a shot next time. And that allows you to run adb and fastboot from anywhere along with automatic device recognition?
Due to technical difficulties when trying to upgrade 12.04 to 12.10, I ended up wiping clean and installing 12.10 from scratch today. I didn't have any luck with the adb to /bin method mentioned above but I did have great luck using the same method I posted in the OP. I updated the thread just slightly to include reference to revision 21 (previously r20).
Changing thread title to reflect that this is working on both 12.04 and 12.10.
I have Ubuntu 12.04 running inside VirtualBox with Windows 7 Pro x64 as the host. It works great with adb (except doesn't like usb3, but usb2 works). I am able to compile AOSP this way, and it works great with adroid sdk. However, the usb connection seems a bit slower, probably something to do with it being a virtual machine. Also, I can't get the virtual android device to work... I think that is definitely a problem with being on a virtual machine.
VirtualBox is a great way if you want to dabble in ubuntu but don't want to commit to dual boot or worry about messing up your windows install.
I have Ubuntu 12.04 running inside VirtualBox with Windows 7 Pro x64 as the host. It works great with adb (except doesn't like usb3, but usb2 works). I am able to compile AOSP this way, and it works great with adroid sdk. However, the usb connection seems a bit slower, probably something to do with it being a virtual machine. Also, I can't get the virtual android device to work... I think that is definitely a problem with being on a virtual machine.
VirtualBox is a great way if you want to dabble in ubuntu but don't want to commit to dual boot or worry about messing up your windows install.
Cool. Yeah I am actually dual booting at this time. Only because my next elder machine is older than the hills and I'm too cheap to buy a dedicated machine for my Linux install.
In a perfect world tho, I would definitely have a 2 machine setup with a kvm switch and dual monitors. I mean while we're dreaming, may as well do it right.
I was dual boot with my xp machine, but that was 6 yrs old, so I just upgraded... got good enough hardware now for a virtual machine! Quad core i7 w/ multithreading, and 16GB ram. I can compile AOSP in less than an hour! Now I just have to learn java, so I can edit the code... lol.
if only drag-n-drop and copy/paste worked across the vm, it would be that much more awesome... I was skeptical about the new ubuntu design, but I am pretty stoked on it now and win 7 (they are very similar in functionality in my opinion). So much easier to navigate the system...
Sorry if this is a bit of a derail for this thread, but the instructions for getting android sdk installed in Ubuntu should work exactly the same if it is running inside a VirtualBox. I have a guest Ubuntu 12.04 LTS x64 installed inside VirtualBox 4.2.6 r82870 inside my host Windows 7 pro x64. I am able to compile working AOSP on it, perform adb/fastboot commands, use the android kitchen, and do all manner of android tinkerings. What follows is what I did to get shared folders and shared clipboard and drag-n-drop (mostly) working.
Quote:
Originally Posted by Eproffittibeta
This website will help you tremendously (sorry, new, not allowed to put links yet) virtualboxes.org/doc/installing-guest-additions-on-ubuntu/
For me those instructions were incomplete as I already had the guest additions installed, but for some reason, they were different than what came in the virtualbox iso (I installed them from the machine menu).
After some Googling, I uninstall those 3 guest addition packages form synaptic package manager, and then installed the guest additions from the virtualbox iso:
Mount the iso (for me it was VBoxGuestAdditions.iso) in the virtual machine cd drive
From VBox menu: Devices > CD/DVD Device > Choose a Virtual CD/DVD disk file... for me it was:
open a terminal in that cd once mounted in your ubuntu virtual disk drive, and run:
Code:
sudo ./VBoxLinuxAdditions.run
This did not result in seeing any new packages installed in synaptic, so I suspect the iso packages are not in any of my synced repositories. I don't think this actually changed my clipboard/drag-n-drop behavior, but it works almost perfectly, except that I cannot drag-n-drop from my guest ubuntu to my Windows host.
However, this did send me on a research spree getting my shared folder working. It involved making sure my ubuntu user was in the usergroup "vboxsf". I had to manually add that group (cant remember if root is required to add the user to the appropriate group).
Code:
usermod -a -G vboxsf <username>
As when I set VirtualBox to automount the shared folder, it is always mounted as root and group vboxsf, and I wasn't able to change those permissions, as they are always reset with each automount.
I've learned so much by messing with my ubuntu vm... hope someone finds this info useful!
The Following 2 Users Say Thank You to dhworph For This Useful Post:
Note that compiling AOSP requires java 6, it wont work with java 7.
Edit: seems I have all of oracle-java6-installer, oracle-java7-installer, openjdk-6-jdk installed, however, "java -version" shows 1.6.0_39, which is from oracle-java6-installer (which has an upgrade to version 42 currently). However, I am scared to to upgrading/removing as I worry it might affect my system stability... I got AOSP working and don't wanna mess with it!
Last edited by dhworph; March 1st, 2013 at 11:22 AM.
The Following User Says Thank You to dhworph For This Useful Post:
Sorry if this is a bit of a derail for this thread, but the instructions for getting android sdk installed in Ubuntu should work exactly the same if it is running inside a VirtualBox.
Just thought I'd thank you for this guide. I've only did this once in late 2011-early 2012? and forgot.
Changed to Xubuntu from Super OS 11.10 (my old system is pleased).
Google gave me your tutorial.
One thing I thought I'd mention for those new to Linux: To keep from getting "permission denied" you need to right click the adb.exe then select properties. Then select the permissions tab. Check the box that allows the file to be run as a program.
I do this for all .exe's in the SDK folder.
PS: Do you know how to set up APK MultiTool on Linux?
I think at least most of the apk-multitool utilities can be run from the shell in linux since they are just jars (apktool.jar, smali.jar, baksmali.jar).
Probably so. I'm just a perfectionist (OCD). Got to have everything running just right.
EDIT: Just noticed my post count. Who Da Thunk It. Two years ago I was just looking for a little help to fix my phone and landed here at Android Forums.
Last edited by AndyOpie150; April 4th, 2013 at 09:19 AM.
Device(s): Nexus 4, Nexus 7 (Retired: Galaxy Nexus, DX2, DInc 2, DInc, LG Ally)
Carrier: T-Mobile
Thanks: 6,246
Thanked 2,400 Times in 1,443 Posts
Could someone chime in and help me get my Ubuntu 12.10 install to mount micro SD card storage using a multicard reader. I've Googled it and found a few things but nothing I've tried works. I don't own any devices with micro SD slots soi this is my only method. Thanks in advance.
jmar
P.S. Didn't want to start a new thread. Hope that this question is cool with you IBT.
Could someone chime in and help me get my Ubuntu 12.10 install to mount micro SD card storage using a multicard reader. I've Googled it and found a few things but nothing I've tried works. I don't own any devices with micro SD slots soi this is my only method. Thanks in advance.
jmar
P.S. Didn't want to start a new thread. Hope that this question is cool with you IBT.
No problem jmar. I don't have a sure answer for you because my multi card reader just works with ubuntu 12.10. I didn't do anything special. If you're not so lucky, I can only guess you'd need to create a udev rule for it. You checked out anything like this yet?
Device(s): Nexus 4, Nexus 7 (Retired: Galaxy Nexus, DX2, DInc 2, DInc, LG Ally)
Carrier: T-Mobile
Thanks: 6,246
Thanked 2,400 Times in 1,443 Posts
Quote:
Originally Posted by iowabowtech
No problem jmar. I don't have a sure answer for you because my multi card reader just works with ubuntu 12.10. I didn't do anything special. If you're not so lucky, I can only guess you'd need to create a udev rule for it. You checked out anything like this yet?
I looked at this and I understood it. But my SD card reader's node cannot be found so I can't get past the first couple steps. I clicked on some other links with no luck. Maybe I need to get a new card reader. Any suggestions?
I looked at this and I understood it. But my SD card reader's node cannot be found so I can't get past the first couple steps. I clicked on some other links with no luck. Maybe I need to get a new card reader. Any suggestions?
If it doesn't show up at all, I'm not sure what to say man. You might try the Linux thread in the Lounge. There's some gurus in there that may have an idea. Wish I could have been more help.
Device(s): Nexus 4, Nexus 7 (Retired: Galaxy Nexus, DX2, DInc 2, DInc, LG Ally)
Carrier: T-Mobile
Thanks: 6,246
Thanked 2,400 Times in 1,443 Posts
Quote:
Originally Posted by iowabowtech
If it doesn't show up at all, I'm not sure what to say man. You might try the Linux thread in the Lounge. There's some gurus in there that may have an idea. Wish I could have been more help.
Hey there IBT: just so I understand, when you plug in you card reader via USB, it automatically mounts? If so, which one do you have so I can maybe pick one up today.
Hey there IBT: just so I understand, when you plug in you card reader via USB, it automatically mounts? If so, which one do you have so I can maybe pick one up today.
Yeah, it auto mounts. It's a Digital Concepts model CR-70 but I have to warn you, it's several years old. I somewhat doubt this model is available anymore but you never know I guess.