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

If you wanna do a useful How-To, hows about one on opening IMG files, altering the contents and then turning them back into IMG files?

You can do stuff on installing perl and using scripts and how best to navigate around perl on both windows and linux...

:D

Phil.
 
LOL Phil.

I will have to be honest - I'm not the man to ask about Windows programming or the environment. Also my Perl scripting skills aren't the best.

I can and would be happy to write a how to for unyaffing boot images in Linux, as that i know.
 
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.


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.

Ok I now have a dual boot Windows 7/ Ubuntu system :D Apparently the Wubi installer does infact work for Windows 7 in case anyone else was interested ;D The Wubi site doesn't say it but I gave it a whirl and it worked flawlessly!
gbhil- I think I'm going to hold off on this because I'm shortly going to be taking your earlier advice and create a full Linux system using linuxfromscratch.com after receiving my Dell Inspirion in about a weeks time. I'm going to use Ubuntu for now to familiarize myself with the Linux side of life and to create the ADB Shell for Android (on the agenda for tomorrow) Thank you for all your wonderful help as I am sure I will be needing it in the future.
Oh and one last side note for those who haven't ran Ubuntu....... It ROCKS! ;)
 
Ok I now have a dual boot Windows 7/ Ubuntu system :D Apparently the Wubi installer does infact work for Windows 7 in case anyone else was interested ;D The Wubi site doesn't say it but I gave it a whirl and it worked flawlessly!
gbhil- I think I'm going to hold off on this because I'm shortly going to be taking your earlier advice and create a full Linux system using linuxfromscratch.com after receiving my Dell Inspirion in about a weeks time. I'm going to use Ubuntu for now to familiarize myself with the Linux side of life and to create the ADB Shell for Android (on the agenda for tomorrow) Thank you for all your wonderful help as I am sure I will be needing it in the future.
Oh and one last side note for those who haven't ran Ubuntu....... It ROCKS! ;)

Great choice IMO. Both the system (everyone has a Dell and all the info to get one to work natively in Linux is easy to find) and going with 2 computers vs dual boot.
 
Ok this is where I'm having trouble. When I use gEdit Text Editor and save the file as ~/eclipse/start.sh
When I type in
cd ~/eclipse
chmod +x start.sh
Nothing happens. Then when I create a virtual device, I try to do the sdkman.force.http=true command and it gives me this error:
[ Error writing /home/chrisgibson/.android/androidtool.cfg: No such file or di ]
What am I doing wrong. Ive tried what I can all the way to uninstalling Ubuntu and reinstalling everything lol.
 
Make sure you're NOT root on your Ubuntu install for this -

What's the output of
Code:
cd ~/eclipse
ls -l

-rwxr-xr-x 1 gbhil gbhil 46 2009-12-15 23:45 start.sh
is the important line. Of course yours wont have my username, homedir or timestamp, but the -rwxr-xr-x should be the same. If it is, you're golden.



What's the output of:
Code:
ls -a ~/.android

We're looking for a file named androidtool.cfg. If it's not there, look at step 7 in the original post again. That file needs made by hand, as Ubu won't let the SDK create it. You can use gedit (or any editor) to make it, I suggested nano because you're already in the terminal.

open gedit
in a new file type
Code:
sdkman.force.http=true
Save the file as ~/.android/androidtool.cfg

then you should be good to go.
 
Make sure you're NOT root on your Ubuntu install for this -

What's the output of
Code:
cd ~/eclipse
ls -l

-rwxr-xr-x 1 gbhil gbhil 46 2009-12-15 23:45 start.sh
is the important line. Of course yours wont have my username, homedir or timestamp, but the -rwxr-xr-x should be the same. If it is, you're golden.



What's the output of:
Code:
ls -a ~/.android

We're looking for a file named androidtool.cfg. If it's not there, look at step 7 in the original post again. That file needs made by hand, as Ubu won't let the SDK create it. You can use gedit (or any editor) to make it, I suggested nano because you're already in the terminal.

open gedit
in a new file type
Code:
sdkman.force.http=true
Save the file as ~/.android/androidtool.cfg

then you should be good to go.

Thanks for the quick response homie! I'm away from my PC right now but I'll check it out as soon as I get back to the crib. Thanks again man!
 
Ok my [-rwxr-xr-x 1] line is the same as yours so we're ok there. However when I enter the command:

ls -a ~/.android

It comes with the error message

: cannot access /home/chrisgibson/.android: No such file or directory.

I have the folder "android-sdk-linux_86" in my "home" folder along with the "eclipse" so I'm not too sure why it's not being found in the terminal.

My other problem is when I go to save the gedit file as "~/.android/androidtool.cfg" I go to save as, then type that in as the file name, but when I click on save the save as window does nothing but highlight the file name excluding the .cfg. I tried to save it as Untitled 1 and go into my home folder to rename the file that way but after typing in the new name it gives me an error saying that slashes aren't allowed........
Sorry I'm being a pita lol.
 
LOL no problem man. Try this from the term NOT as root.

Code:
cd ~
mkdir .android
cd .android
cat 555 >> androidtool.cfg
You will get an error about no such directory as 555 or something to that effect. Ignore it.

What this all means -
cd ~ means change directory. The ~ means the current users HOME dir
mkdir .android means make directory, and name it .android . The . in front of the name means it's a hidden folder.
cat 555 >> androidtool.cfg means concatenate and print the input as a standard file. Using the made up file "555" ensures the output (androidtool.cfg) will be a blank file. You get the error because the file ~/.android/555 does not exist.





Next -
Code:
nano -w androidtool.cfg
you'll get a blank file. Type in
Code:
sdkman.force.http=true

then control + x
then y
then Enter.

And what all this means -
nano -w androidtool.cfg - this means run the terminal editor nano with the file androidtool.cfg and make sure it's writable (-w).
sdkman.force.http=true is the setting that allows for non secure download sites. You're writing this into the file, just as if it were a Windows .ini file.

control+x = 'exit' in the nano program
y = nano asks if you want to write the buffer to the open file (save it)
Enter = accept the current path of the file you want to save. It will be the path of the open file, so we're just hitting enter.

nano will exit you back to your prompt.

Now try creating your device.

Of course, the correct way would be to troubleshoot why you're unable to save the filename in gedit, but that's almost impossible to do over the net. My gut tells me this bit is user error (you're used to Windows apps, or have a folder with the wrong permissions and you can't write to it.) If it's a file permission error, you'll see a descriptive message in the terminal since you're using it. Any errors, just say what you get and we will go from there.

Good luck!
 
Wow! I'm a genius! LOL. I realized my [obvious] error this morning when going back over everything. Where your command is "cd ~/android-sdk-linux/tools" mine obviously won't read like that because my sdk file isn't named that. On my system it's "android-sdk-linux_86"! I am a duffus lol. Thank you so much for your patience and guidance Jerry! You have no idea how much of a help you have been!
 
HA!
That's great news, and funny as hell :D
Don't worry though. EVERY one of us has been there.

Future reference - from your term type in
cd ~/an
Don't hit enter, hit the tab key. if nothing happens, hit it again.

Auto-complete FTW!


One last idiotic way Ubuntu forces things to be done - whenever you are abd-ing into your phone, you have to actually start the process as root and not as chris with su permissions. It's either a PATH issue or a permissions issue, haven't really looked into it yet.

open term
cd ~/android sdk directory/tools
sudo su
your password
./adb shell
exit

that makes you root, fires up the adb server, then exit drops you back out of adb shell. From there you can go back in, push or pull files, or do anything that needs the adb server running. When you're done, keep typing exit until you're back to your regular login so you dont have a root shell sitting there ready for something silly to happen ;)

Now get to bricking that phone lol!
 
Code:
cd ~
mkdir .android
cd .android
cat 555 >> androidtool.cfg
You will get an error about no such directory as 555 or something to that effect. Ignore it.

Or just use instead of cat:
Code:
touch androidtool.cfg
This won't give the error :)
 
This is exactly what I was looking for! I've got my computer dual booted (Windows 7 and Ubuntu 9.10) and I'm ready to help out this community - but didn't know how to get everything else installed.

Seriously, Gbhil -- you are the man!! Not only do you make outstanding ROMS/etc, but you also share your knowledge along the way -- which is far more important. (Open source learning/education FTW!!) Thanks for all your hard work! I'm sure everyone learns a **** tun from you, I know I do!:D
 
Out of curiosity, has anyone tried this using VMWare Instead? I have Ubuntu 1.10 running on VMWare and have successfully setup and installed Eclipse and everything. If this works and is do-able on VMWare, I can possibly zip up and upload my VMachine for others to use :)
 
Out of curiosity, has anyone tried this using VMWare Instead? I have Ubuntu 1.10 running on VMWare and have successfully setup and installed Eclipse and everything. If this works and is do-able on VMWare, I can possibly zip up and upload my VMachine for others to use :)
Not I. Try it anyway, what's the worst that could happen right? It's a VM.:rolleyes: I personally like dual booting -- it forces me to learn Linux and so far, I've primarily booted into Linux 95% of the time since setting it up this way.
 
if you are just using adb in VMWare, that should be ok. For developing apps though, I'd dual boot. I've used VirtualBox w/ Ubuntu 9.10 for a while, but with Eclipse, the Emulator, and GIMP going, it's really slow. I've since set up a dual boot, and it makes a huge improvement in performance.
 
I know this is Ubuntu/Windows, but hope I can post this question here since i am new to all this and never used Linux before... i hope this isnt a really dumb question... but i have a AMD64 bit desktop, but am running XP, when i go to download Ubuntu, should i choose the 32 or 64 bit iso. I am actually installing on a seperate hard drive, not on a partition within Windows. Also, will i still be able to choose a boot OS when turning on my system? Thanks for any help provided.
 
I know this is Ubuntu/Windows, but hope I can post this question here since i am new to all this and never used Linux before... i hope this isnt a really dumb question... but i have a AMD64 bit desktop, but am running XP, when i go to download Ubuntu, should i choose the 32 or 64 bit iso. I am actually installing on a seperate hard drive, not on a partition within Windows. Also, will i still be able to choose a boot OS when turning on my system? Thanks for any help provided.

You can use either.

Ubuntu x86 vs. Ubuntu AMD64 - Wikiversity
here's a link debating the pros and cons of each. FWIW if you're installing Ubu for Android development, stick with 32 bit - it's easier to set up and all the walkthroughs from Google are 32 bit based.
 
any idea about downgrading android 1.5 emulator to RC29

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

any idea about downgrading android 1.5 emulator to RC29 ?? i need this to get root access...