HOW-TO: Setting up Android adb shell/Programming envrionment using Ubuntu in Windows

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,796
113
Visit site
I just spent all day figuring this out for a good friend and was wise enough to document it so I could share. The scope of this How-To is to help a user set up a native Linux shell and programming environment for Android OS using Ubuntu 9.10 over an existing Windows installation. The steps are outlined below.

1. Make sure you have enough room on your hard drive. I recommend at least 10 GB for the system and applications. This space will be unavailable to Windows after you're done.

2. Fire up your web browser and go to Wubi - Ubuntu Installer for Windows . This is basically a batch file that does everything needed to install a generic version of Ubuntu 9.1 on your computer. Using this, it's easy to uninstall the whole Linux installation from the Windows control panel. If you've never tried installing Linux before, this is for you.

3. When you're all done and restarted, play with Ubuntu for a bit. Learn how to open Firefox and the terminal. Search for some Ubuntu user forums and do some reading. Once you're familiar enough with the OS and you're ready to install everything, cruise back here and continue.

4. You have to install Sun's Java Runtime Engine (JRE) and Java Development Kit (JDK). You also need to remove OpenJDK and other incompatible Java items.

Start gnome-terminal from Ubuntu's main menu Applications -> Accessories -> Terminal and run these commands one by one.

Code:
sudo apt-get remove -y --purge openjdk-6-jre openjdk-6-jre-lib openjdk-6-jdk gcj

sudo apt-get install --reinstall -y sun-java6-jre sun-java6-jdk sun-java6-fonts

Anytime it asks for a password, it means your user password.
If you need to confirm the license, press TAB-key or arrow-keys to move the cursor in the text window.

5. Install Eclipse. Before you begin, you need to be sure you don't have any bits of the standard Ubuntu Eclipse version. In your terminal type
Code:
sudo apt-get remove eclipse
Then browse to Eclipse Downloads and download the "Eclipse IDE for Java EE Developers (188 MB)". To determine which version (32 or 64 bit) you need, in your term type:
Code:
uname -a
You'll either see i686 (for 32bit) or X86_64 (for 64bit Linux). Download the correct version. On your menu, open Places->Downloads and click the eclipse package you downloaded. File Roller will open. Drag the folder into your Home folder. It should create an "eclipse" directory in your $HOME area (like /home/username/eclipse/). Then check the eclipse directory.
Code:
cd ~
ls -l
you should see eclipse listed. There's a bug between Ubuntu 9.1 and eclipse. It's easy to fix. Applications->Accessories->gEdit Text Editor. In the blank document that opens type the following:
Code:
GDK_NATIVE_WINDOWS=true $HOME/eclipse/eclipse
Save the file as ~/eclipse/start.sh.
In your term:
Code:
cd ~/eclipse
chmod +x start.sh
Then anytime you want to start eclipse type:
Code:
cd ~/eclipse
./start.sh
You can also create a launcher (shortcut) on your desktop by right clicking on the desktop, selecting create launcher. The command should point to the start.sh file you created.

6. Download the Android SDK for Linux by browsing to Android SDK | Android Developers . Take the newest SDK version for Linux (i386). It will work on all Linux versions.
Once again, open your downloads folder and click the SDK. Drag the android-sdk-linux folder into your home folder.

7. Create a Virtual Device. Open your term and type
Code:
nano
This will open a console text editor. We have to fix another bug before we can continue. In the editor that opened type:
Code:
sdkman.force.http=true
then CTRL+X . It will ask you if you want to save the buffer (file). Type y for yes. It then asks for a name, type
Code:
~/.android/androidtool.cfg
then enter.
Now we need to move to the android/tools dir and start the adv manager.
Code:
cd ~/android-sdk-linux/tools
./android
This will start a gui to set up your environment. In the dialog that opens:
1. Select Available Components in the left panel. This will reveal all components currently available for download.
2. Select everything and click Install Selected.
3. Verify and accept the components you want and click Install Accepted. The components will now be installed into your existing Android SDK directories.
Close the dialog.

Back in your term type
Code:
./android create avd --target 2 --name my_avd
In the "target" field, use 1 for a 1.5 device, 2 for a 1.6 device and 3 for a 2.0 device. The above will create a device using Android 1.6.

8. Install the Android plugin for the Eclipse IDE.
Now start the Eclipse IDE and select Help -> "Install New Software..." from the menu. The "Install" dialog for new software should appear. Then press the [Add...] button and fill in these values.
Code:
Name: Android plugin
Location: https://dl-ssl.google.com/android/eclipse/
Then stay in the same dialog and wait 5 - 10 seconds. You should first see that the status changes to "Pending...". It will now communicate with the Google's site and download the most recent plugin. Wait until the status or text changes to "Developer Tools", then check "Developer Tools" and all its subitems. Click the [Next...] button to move forward. gain, click the [Next..] button to move to the final dialog and accept/confirm the license text. Then select Finish.

9. Eclipse IDE has to know the location of Android SDK. It's very easy to set. Start the Eclipse IDE and select Window -> Preferences from the main menu. Select "Android" from the list. Then click the [Browse...] button and set the path of SDK Location. (It's in your HOME directory. You downloaded and extracted it above).


Congratulations. You now have a native Linux environment to use the adb shell, complete with the tools to develop Android applications if you wish.


Feel free to ask any questions, I did my best to document and catch any issues but I'd imagine I missed at least a few. :D
 

dkoss

Well-known member
Nov 12, 2009
252
37
0
Visit site
I am trying to set up the adb shell on Ubuntu 9.1. I've successfully set up the SDK Manager and my virtual device. I also have Eclipse 3.5.1 Galileo installed but everytime I try to install the ADT for Eclipse I keep getting this error:
"Cannot complete the install because one or more required items could not be found.
Software being installed: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404)
Missing requirement: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404) requires 'org.eclipse.wst.xml.ui 0.0.0' but it could not be found"
I have attempted to update Eclipse but get no updates needed, tried to install the ADT manually with a .zip file but get the same error. I was just wondering if you might have any insight as to what is going wrong or if I need to go to an earlier version of Eclipse, any help would be greatly appreciated.
 

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,796
113
Visit site
I had similar errors. I ended up having to apt-get remove the Deb/Ubuntu version of eclipse, and download direct from their site and extract it in my home dir.
 

dkoss

Well-known member
Nov 12, 2009
252
37
0
Visit site
Yea that's what I was attempting yesterday but I couldn't get to their website eclipse.org kept taking me to a smartphone site, but I'll try it again. Just glad to hear it's not just me going insane and forgetting some small step. Thanks for your time, I'll let you know how it goes.
 

dkoss

Well-known member
Nov 12, 2009
252
37
0
Visit site
Thanks for the link gbhil. I was able to set up the ADT finally. I just wish I would have used this post about 4 days ago (I actually saw this post a while back but thought it was only for dual boot purposes). Nice job on the layout and steps for the installation they are just about what I fought through for the past week (my wife calls it obsessive, I call it determination lol).
 

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,796
113
Visit site
LOL. Youre welcome man. The important part of it all?

You got it up and running :) Many moons ago, I had a professor, an old gentleman from Taiwan...He always used to say - "We aren't here to enjoy the results. We are only focused on the journey there."
 

dkoss

Well-known member
Nov 12, 2009
252
37
0
Visit site
So true, I'm just glad that that their are guides such as yourself and the gentleman you quoted for those WTF moments.:D
 

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,796
113
Visit site
So true, I'm just glad that that their are guides such as yourself and the gentleman you quoted for those WTF moments.:D

We all have to learn. IMO there's no point in giving someone a list of commands without letting them know the whats and whys.

gbhil I would hire you as my mentor if I had the funds to give you what you're worth! YOU DA MAN!!!! Lol!

LOL. Hardly. I'm just here to share and learn about our gizmo's just like everyone else. Just glad i can help even in a little way.
 

YoungChrisG

Well-known member
Nov 10, 2009
342
6
0
Visit site
Hey gbhill, I have a quick question about doing this. I'm about to update my desktop to Win 7 Ultimate. Will this have an affect on using your tutorial or should I stay at Win Vista?
 

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,796
113
Visit site
I don't think Wubi (the windows installer for Ubuntu) will run on 7. Yet.

Now would be a good time to back everything up and wipe that HDD. A dual boot system with a 16 gig USB stick as a shared drive is what I use, and as long as you know your hardware it's just as easy to build.
 

GivenToFly

Well-known member
Dec 30, 2009
116
3
0
www.apexautosound.com
7. Create a Virtual Device. Open your term and type
Code:
nano
This will open a console text editor. We have to fix another bug before we can continue. In the editor that opened type:
Code:
sdkman.force.http=true
then CTRL+X . It will ask you if you want to save the buffer (file). Type y for yes. It then asks for a name, type
Code:
~/.android/androidtool.cfg
then enter.

When I get to this point, I get "Error writing, no such file or directory"
 

GivenToFly

Well-known member
Dec 30, 2009
116
3
0
www.apexautosound.com
Try creating it first.

Code:
mkdir ~/.android

nano should be able to do this, but that's the first thing I would try.

Was just gonna edit, because I figured that out, but now I got another problem. Eclipse can't find the android SDK. I tried pointing it to android-sdk-linux folder, then to every other folder in there i can find, but got nothin. The android sdk manager says "SDK Location is android-sdk-linux, but when i open that folder manually, I don't see anything there other than the originally downloaded stuff. Should I see some other things there?
 
Last edited:

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,796
113
Visit site
Make sure you're in your home directory, and highlight the SDK folder but don't click to open it, then hit ok in the file browser window.
You'll need to hit apply, then OK in the Eclipse window.
 

GivenToFly

Well-known member
Dec 30, 2009
116
3
0
www.apexautosound.com
did all that. Completely uninstalled everything that the android manager did, then re-downloaded, and did it again, and its working now. Weird. That happed to me for some other stuff I've done since i put Ubuntu on this computer. Thanks for all your help, and your super fast replies.
 

YoungChrisG

Well-known member
Nov 10, 2009
342
6
0
Visit site
I don't think Wubi (the windows installer for Ubuntu) will run on 7. Yet.

Now would be a good time to back everything up and wipe that HDD. A dual boot system with a 16 gig USB stick as a shared drive is what I use, and as long as you know your hardware it's just as easy to build.

I'll bet you don't have any helpful how-to's on doing that up your sleeve do ya my friend? :D
 

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,796
113
Visit site
did all that. Completely uninstalled everything that the android manager did, then re-downloaded, and did it again, and its working now. Weird. That happed to me for some other stuff I've done since i put Ubuntu on this computer. Thanks for all your help, and your super fast replies.

Lol. Sounds about right. There's a big trade off for using Ubuntu. It makes Linux more friendly and easier to use, but 'normal' Linux packages don't always work well. I'm glad you got it working.

I'll bet you don't have any helpful how-to's on doing that up your sleeve do ya my friend? :D
1. Use some software (like Ghost) to clone your drive to a DVD. This way if you change your mind you can restore everything back the way it was.
2. Pop a Parted live CD in GParted -- Live CD/USB/PXE/HD and wipe and repartition your HDD, leaving about 50 gigs free space for Linux.
3. Re-install Windows, but don't touch the empty 50 gigs
4. Either use windows to find exactly what hardware you're using and find out what it takes to make it work with Linux, or just use Ubuntu. Ubuntu will work with any hardware that supports Linux, usually right out of the box.
5. Install Linux on the empty 50 gig partition, making sure you follow the prompts during install to have a dual boot with Windows system.
6. Format your external storage (I use USB sticks) FAT32 in Linux, and it's readable under Linux and Windows for a nice easy shared drive.

Numbers 1 2 and 3 give you a fun starting point :)
If you decide to go with it and make it that far, holler.
 

Trending Posts

Forum statistics

Threads
941,386
Messages
6,908,465
Members
3,157,891
Latest member
iyekdroidcentral2