SDKs, drivers and roots - Oh, my!

Hey, all. Introducing a new feature to our AndroidCentral readers. It's a little space where we can discuss and feature the weeks best in the Android modding and hacking community, in terms that even those new to Android can understand.

This won't be device or carrier specific, so think of it as a showcase of everything Android has to offer us because of its open nature. Our seasoned veterans may find some of this redundant, but we're going to try to keep things on a level all can understand so we stay on the same page. This week's version is going to be a bit long so we can introduce some things, so bear with me.

Please keep in mind I can't be everywhere at once (until I perfect my cloning machine!) so it's possible I'll miss something that you didn't. The best way to keep that from happening is to send me your tips and links about all the cool ways we are customizing our phones. Just like the customizing community let's make this a joint effort!

Now on to the goodies.

Each week we're going to feature some of the tricks you can do with just the command prompt and the data cable. While there are downloads and zip files and ROMs and all other sorts of coolness you can do with your phone, often the simplest tricks can make the most impact.

The Android SDK

This week we're going to start at the beginning. Installing the Android SDK -- that's short for Software Development Kit -- which is what lets developers do their thing. And now you can, too.

Step 1: Prep work and download

First, let's prepare a workspace on your PC. My suggestion is to create a folder in the top level of your hard drive so it's easy to get to from the command line. C:\Android_stuff is much easier to remember than C:\users\gbhil\documents\tools\devices\Android\stuff. I use my workspace for backups, wallpapers, ROMs, and tools as well as the SDK. Simply make a separate folder inside your workspace for each. Click the image below to enlarge it and see how I have my Android_stuff folder set up.

Now it's time to download the SDK. Head to http://developer.android.com/sdk/index.html. You'll see downloads for Windows, Mac OS X, and Linux. Pick the appropriate category and download the file to your desktop. Don't be put off by the license agreement. Have a read and you'll see it's pretty standard.

Unzip the download with your favorite archiving tool and drag the folder you extracted into your Workspace. Don't open the folder, just drag the whole thing over. That's it. The Android SDK is now installed.

Step 2: Install the USB driver - a necessary evil

Installing the USB driver is almost as simple, though it takes a few steps, and you'll need to do it if you're running Windows. Open the SDK folder that you just moved over, and double-click "SDK Setup.exe" in the SDK directory. You'll be see a window like the one below.

Make sure "Available Packages" in the left pane is selected.

Click the triangle beside the globe on the top line to expand the list.

What I have circled in red in our example picture needs to be checked. That will download the USB driver. Unless you have an interest in software development or running an Android device emulator, you can leave everything else unchecked. If you decide to install the other portions, be prepared for a 1 Gigabyte download.

Click install selected. The driver will download itself into the SDK.

Now on your device, hit the menu button. Choose Settings (fig 1), then choose Applications (fig 2). Now click Development (fig 3), and make sure USB debugging is checked (fig 4). Use the back key to exit back to your desktop.

Now, plug your phone in, just as if you were going to transfer a song or a picture. But this time don't pull down the shade and mount the SD card. You'll get a "Found New Hardware" message from Windows.

Select "Locate and install driver software."

Select "Don't search online."

Select "I don't have the disk. Show me other options."

Select "Browse my computer for driver software."

Now browse to the SDK folder, and point Windows to the folder named usb_driver. Click the image below to enlarge it and see the usb_driver folder inside your Android SDK.

Leave "Include subfolders" checked, and click "Next." Windows might ask you if you're sure. Say yes if it does. When windows does it's thing, and asks you if you want to install the "Google ADB interface driver" say yes.

Of course if we want to run emulators or program applications there's more to it. But for our purposes, we're done. Unplug your phone and reboot your computer.

Now is a good time to mention that you probably shouldn't ever reboot your PC while your phone is plugged in. Some newer PC's can boot from a USB device, and will try to load Android to your PC if you do. As interesting as that sounds, it won't work, and could lead to problems.

Funny how the hardest part of the whole operation is setting up Windows isn't it?

First test: Back up your apps

Here's a trick that anyone can do, even with an unrooted phone. Plug your phone into the computer, the same way you would if you were transferring pictures or a song, except once again don't pull down the shade and mount the SD card. Anytime we're interacting with the phone through the command prompt, the card will need to stay unmounted.

Now open your command prompt. In Windows, just hit the start menu and type (either in the Windows 7 search field or the "run" command in XP) "cmd." Don't let that 1960s computer look scare you off, this is going to be easy.

At the prompt, navigate to the location you put the Android SDK. If you're following our example, just type (or copy and paste) the following in your command line:

cd C:\Android_stuff\android-sdk-windows

If you are using a different location, modify the command to point to the location you've placed your Android SDK.

Inside the SDK there are some other folders. The one we will usually be working with is the tools folder. Navigate into it by typing the following into your command prompt:

cd tools

Click the picture below to get a larger view of the commands typed into the Windows command prompt.

Now open up your file manager, and in your workspace make a folder called apps. We're going to back up all of our applications here. The market keeps a record of what you've paid for, but sometimes finding the free ones again can be a pain, so lets keep our own copy. If you scroll up the page to the image of my Android_stuff folder, you'll see an apps subfolder is already in there.

At your prompt type in the following:

adb pull /data/app/ C:\Android_stuff\apps

Just copy and paste it. What it means is -

use the adb program (provided by Google as part of the Android SDK) to pull files.

The files we are pulling from the phone are located in /data/app on the phone itself.

When a file is pulled off, we want to paste it to C:\Android_stuff\apps.

Why are the slashes different from the first part of the command to the second part?

It's because we are dealing with two different file systems. In a Windows file system, the slashes are backwards, like so " \ " . Unix file systems use the forward slash " / " to separate folders. /data/app/ is on the phone, and uses a Unix file system. C:\Android_stuff\apps is on your PC so it uses the Windows file system.

You might see a message about a server being out of date, or a server getting killed. This refers to the adb server, and the command will refresh it if necessary. Don't be concerned, it's automatic. You'll see the window start to scroll, with the output from adb telling you it's copied each application. There's no interaction needed, just let it scroll. When it's finished, you'll be back at your command prompt. Now a copy of all your free market applications are stored on your PC for safe keeping. The files all have an ".apk" extension. This is the standard Android installation format, so these files can't be used in Windows.

No root. No convoluted shell commands. Just an easy way to back up all your applications. These applications can be copied over to your SD card, and installed with any app that can read the card and install apk files. If you don't have an app for this, search for Astro in the market. It serves as a file explorer (like My Computer in Windows) and offers some other great tools for application management.

This is just the tip of the iceburg. Until Android comes out with an easy-to-use iTunes-style application to interact with the device, I'm here to help you work with the command line. Each week we'll focus on something similar. Happy hacking :)

Picks of the Week

Overclocking your Droid (root required!)

The most popular Android device now has the most requested feature upgrade. The kernel has been tweaked and the processor has been overclocked. Here's the developers thread about it, and A/C user thebizz has started up a discussion in our own forums.

WARNING: There is potential here to ruin your device (as with all modifications), but the developer has done a good job making it foolproof. He even has set up a dedicated support area for questions. It's my personal opinion that the Droid's processor can take a bit more abuse than Moto has it set at, so this could be a very useful update indeed. If you try this out, be sure to share your experiences in the forums, as many people seem to be on the fence with this one. Of course you'll need to be rooted and have a custom recovery image flashed. If this is all Greek to you. You'll find plenty of help in the forums.

Cyanogen's Nexus One ROM (root required!)

Legendary Android Hacker/Cooker/Modder/Guru Cyanogen has released a custom ROM for you lucky Nexus One owners. Some of his G1 hacks aren't included, as there's no need with the great hardware of the Nexus One. But that's not to say this isn't full of the goods. Here are a few highlights:

Of course there's more, that's just the short list. Cyanogen's work is always top-notch, enough so that many of his changes have been included in the Android source tree. It's a tall order to make the Nexus One perform better than it already does, but I can tell you this – it does everything but fly using this build, and I highly recommend you have a look.Cyanogen Mod homepage http://www.cyanogenmod.com/ . A/C user rsvpinx has started A/C's discussion topic about the ROM here in our forums.

MetaMorph (root required!)

Maybe MetaMorph is an application. Maybe it would be better served with a full blown review in the Application forums. But I just can't get enough of this tool. What it does is allow the end user to download a custom theme and load it on the phone without the hassle of recovery images and ROM flashing. I talked to Stericson over at XDA developers and asked him a few questions about the application:

Your app is a huge breakthrough in the way themes and visual elements are changed by the end user. How did you think of it?

I will probably get shot when I say this, but the iPhone project that essentially does the same thing turned me on to the idea.

What resources do you recommend someone new to Android and your application take a look at to make it easier to use MetaMorph?

You're giving your users very timely updates. Can you give us any news about upcoming features?

Well, the theme repository is coming soon. I got a bit burned out on working on MetaMorph only so I am currently working on my other app, CodeSpeak, but I am still working on MetaMorph. I also have some people who are wanting to come on board and assist with the Development of MetaMorph as well so I am also giving them a chance to put some time in on the project.

The decision to provide the same feature set in the free and donate version was great for the consumer. Do you feel it crippled any potential for real profit?

No. I never made MetaMorph to be a for-profit app. The donate version of MetaMorph came about because people kept asking me how they could donate to me for the work that I have done. The easiest remedy was to supply a donate version of MetaMorph. Then the donate version somewhat turned into a beta testing version of sorts :)

Where would a budding theme developer look to start creating MetaMorph themes?

I'd like to thank Stericson for taking the time to answer a few questions for us, and for the great application. Using MetaMorph, anyone with a talent for graphics work can easily become an Android theme developer.

As Stericson pointed out, the official support thread for the app along with a ton of info is at XDA developers here. A/C user mclarryjr has started up a nice discussion in our forums about how to make the magic with this one here at our forums . Hit the QRcode from your phone (or click it in your Android browser) to go straight to the market and grab MetaMorph.

Hope you enjoyed this week's installment of Inside Android. Remember I'm always looking for tips and opinions Find me on the forums or drop me a line gbhil.hero@gmail.com

If you're on Windows Vista or 7 try right clicking and select run as administrator (or something to that effect). I know when I was playing with the SDK a while back on windows 7, I had to do that a few times.

Windows gets a little cranky sometimes. I would recommend (in order)
a restart (of your PC),
trying a different USB port, or
trying to shut off USB debugging on your phone before you plug it in, then eanbling it again after it's plugged in.

I get the same...
It seems I have nothing in my /data/ folder? I show nothing in Astro and when I try to adb it says 0 files pulled. 0 files skipped.
Am I missing something?
I also tried to push a new bootanimation.zip file and it said "failed to copy 'bootanimation.zip': Read-only file system"

Ok. I was able to push a new bootanimation.zip to /data/local/ and I can see my device serial with adb devices command. I was able to pull from /system/media/ dir but still nothing in /data/app/... I am lost?

What device are you using? Are you running stock or rooted? Custom ROM?
Pushing a file (you only push or pull files, not folders) to anywhere but /data/ requires you be rooted and remount the file system as writable.
What is the output after you type adb shell (while inside the androidSDK/tools folder) with your command prompt?

After you enter the adb shell, try the command ls /data/app in your command line.
This should return a list of your installed third party applications. If this list is not blank, try the commands to pull the files again. Of course exit the shell first. Pay close attention to the syntax of the commands, especially that the slashes in the file paths are correct.

Great. I'm looking forward to them as well. Writing it all down helps me learn a little bit more each time. It's true that Android has a bit of a learning curve compared to some of the other platforms. I think together we can all see it's not as difficult to work with as it seems on the surface.

Thanks for this...great info. I'm running the HTC Eris and never get the "Windows found new hardware" message. My suspicion is that since I've installed HTC Sync software, that the usb drivers are already installed.

Problem is I also get the 0 files pulled message. I'll have to do some more testing I guess.

I also have a Sprint Hero and didn't get the add new hardware routine to install the adb USB driver, but I was able to install it manually. When I try to pull the apps, I get the following error messages:

adb server is out of date. killing...
* daemon started successfully *
error: device not found

EDIT: fixed that; had to uninstall the driver and reinstall. But now I'm getting the 0-0 files error.

So many Sneaker heads and members of Kanye's fan base asked the question ''Where can I buy the Kanye West Air Yeezy Online?''For each of these colourways only 3000 pairs were made each and they pretty much sold out within the time you woke up, could have a shower and drive down to the stores.

This happened to me also. Under available packages screen click on "ADD SITE" Then type in the URL with HTTP (no s) as suggested in the error message. This downloaded the files for me (USB driver is now Rev.3)
After doing this however when I plug in my phone I still do not get the message "Found New Hardware" Rather my "regular" HTC sync program starts up as usual. Do I need to somehow remove HTC sync from my PC before I attempt to load the new USB driver???

1. Drivers were already installed, which is why my computer would not prompt me to install drivers. If you've connected your phone to your computer before, this may be the same case for you. when I tried to install the drivers manually through control panel -> device manager, it said the drivers were already up to date.

So it worked fine for me without having to update or install any new drivers.

2. Pulling the apps didn't work for me because on my Hero it does not save the apps where the article states. Maybe thats the case with others who are getting the "0 files" pulled message as I was.

I am not sure where they are saved though. But to test to make sure the SDK is working I pulled the default apps off the phone. The default apps folder on my Hero is located at /system/apps/ so instead of the suggested :

For those of you that are having trouble in regards to "Found New Hardware" message not appearing here you go:

Problem
1st. I had connected my phone to my computer many times prior to this so that seemed to be the problem. Drivers were installed for the phone(HTC Hero) & that was the problem. When trying to install this adb driver the computer thinks its not necessary because you already have a driver that is up to date.

Solution
(Excuse me if the instructions are not the clearest. I should have wrote this as I performed this step.)
You have to uninstall the old driver. *The Driver won't appear if your phone is not plugged in. Connect your phone to computer
Right-click on "computer"
In the left column click "Device Manager"
On the right a long list will appear. Near the top you should see the words "Android Phone" or something similar.
Double-click that and under it you will see the driver. It will probably be different depending on your phone. Mine simply said "HTC" something, I forget.
Right-click and uninstall it. Unplug the phone safely then restart your computer.
After this proceed to follow the original instructions & you should now see "New Hardware Found" when you plug your phone in again.

Can anyone please help. I attempt to create the backup and I keep getting "0 files pulled. 0 files skipped."
I have an HTC Hero. Are we looking in the wrong folder? Do the directions above pertain to other phone? HELP

I was getting the same on my hero. After looking into it I discovered that I needed to use this line.
adb pull /system/app/ C:\Android_stuff\apps
instead of this line. This is because on the Hero the apps are not stored in the data section. They are instead stored in the system section. This should fix you up.
adb pull /data/app/ C:\Android_stuff\apps

I've been going at this for some time and can find that only the system apps are stored in the system folder, not 3rd party apps... Does anyone know where 3rd party apps are stored? I have several file managing apps on my Sprint Hero (OI File Manager and ASTRO) but nothing appears in /data/ and only pre-loaded system apps appear in /system/app/ I know this is not a huge deal but I really want to follow these instructions as closely as possible and back up as much as possible before voiding my warranty and screwing my phone up to hell because I'm part retarded.

@gbhil is there any other place 3rd party apps are stored on a Sprint Hero...? I'm having trouble with that initial app pull through adb and can't locate the .apk files using an on-the-phone file manager.

I used this method to root my phone awhile back and it worked fine. It seems that since I flashed Fresh 2.1.2 I no longer have root. I went to command prompt to reroot and it says "no adb devices found." So I set up sdk again and downloaded driver rev3. When I connect phone, for step 2, and locate the folder with the driver it says "no driver found adb device not installed" Anybody know what is going on here?

update* Disregard this post, I installed HTC sync and was able to access adb device in command prompt again

I'm running Windows XP and using a myTouch 3g slide and i downloaded everything and when i plug my phone in i get found new hardware ADB and i select the usb_driver folder and then i get "the hardware was not installed because the wizard cannot find the necessary software" can someone help me

Try running it from the command line. It will show an error if it cannot run.

Additionally, the error I specifically had (Windows 7, also, with Moto Droid, though the Droid part is irrelevant) when trying adb/ddms, was that Java was not added to my Classpath/PATH Environmental Variables.

If you right click Computer, click Properties, Advanced system settings (on the left), Environmental Variables, and then under System variables, you should make sure to add your JDK location's \bin directory for both Classpath and PATH. (They're separated by semicolons, by the way)

Hey guys, I am new to the android community. I have been reading all of these comments and have had the same problems but none of the solutions seem to work for me. I am running Win7 on my computer and have a Sprint HTC Hero. I do not get the "Found New Hardware" message...when I plug in my phone it automatically gets some driver. So I go into the Device Manager and update the driver and point it to the right location and click next but it tells me Windows has determined the driver software for your device is up to date and it is not the right driver.

I have uninstalled/reinstalled and played with settings but nothing seems to work...Can somebody help me?

i am trying this on my bionic and i get an error adb is not an internal or external comand.
so i found that the adb exe. was in platform-tools. so when i run the adb comand from the new directory (platform-tools) i get 0 file 0 transfer

Yeah, these instructions don't work. After the part there you make sure USB Debugging is checked...none of that crap comes up to finish the process. If anyone would like to help, I'd appreciate it. Before I throw my phone through a window please

HELLLOOOO... Yeah it's certainly screwed up to leave this stuff out there without updating or editing and posting a link to something that does work, cuz it SUCKS to have wasted all this time and then find out it doesn't work :?(

Just in case you were not aware of this, on my system there is no SDK Setup.exe, it is called SDK Manager.:) I am just mentioning it because I am a huge n00b and so I spent quite a while looking for SDK Setup.exe before I realized that it was probably that SDK Manager file.

Portions of this page are modifications based on work created and shared by the Android Open Source Project
and used according to terms described in the Creative Commons 2.5 Attribution License. AndroidCentral is an independent site
that is not affiliated with or endorsed by Google.