How-To: adb for Windows, made easy?
OK, so we all want to jump in and mod/hack our Droid and rightfully so, being open source and all.
But wanting and able to do can be a little frustrating for some, me included, until I figured it out
We see people answering our questions, "just do adb to do this and that". Which usually makes us react when we first see it "adb?, what the he!! is that, and where is it?", I don't get it in terminal or get errors", etc etc.
ADB = Android Debug Bridge, In a nutshell for our(typical users) purposes, It allows us to access our Droid using the Command Prompt on our PC. If you want to know more, google it, or visit Androids Developer site here:
Android Debug Bridge | Android Developers
Also for a little more in depth information, check out the thread here at the DroidForums written by alquimista:
How To Use ADB: All Commands and Options
I'm going to try and layout as simple as I can, how to set it up on a Windows PC. I'm sure there are other variations or preferences by others, but this is how I did it, and it works as designed.
I'll try and keep it simple as possible yet with just enough detail to hopefully eliminate some of the frustrations,,lol.
NOTE: If I miss anything or you have something to add(without getting to complex) please let me know and I'll make the appropriate edits to this post.
We need to get a few things before getting started with adb, so for now it's just download time.
Download everything to your Desktop for now, so you don't have to hunt them down later during this process. When we're finished and if you decide to keep everything, then move the downloaded files to where ever you please.
Download the SDK from Android - This is where the "elusive" adb resides.
Android SDK | Android Developers
(The link takes you to the download site where you can get the SDK for Windows, Linux, and Mac.)
Windows users download android-sdk_r04-windows.zip (current version at time writing this guide- Make sure you get the latest version though)
Download the Motorola USB Drivers
Motorola drivers are needed for proper communication between adb and our Droid in Windows.
Your going to get one of these:
Motorola 4.6.0 Driver with MotoConnect* (for 32-bit versions of Windows®)
Motorola 4.6.0 Driver with MotoConnect* (for 64-bit versions of Windows®)
Depending on your version of Windows.
Download the drivers here:
USB and PC Charging Drivers - Motorola USA
(Don't worry about the PC Charging Drivers, they are not needed)
Installing and Setting Up
Extract the android-sdk_r04-windows.zip to your local drive, this for most will be C:
Afterwards you should see a folder on your C: drive called android-sdk-windows.
The path should be:
To make things a little easier for later, we're going to rename it. So right click on it and select "rename", type in android, hit enter on your keybaord and make sure the name change takes effect.
Now the path should be:
Guess what?! You just installed SDK and ADB! Simple enough, right
Motorola Driver Installation
Why do I need these when I can already see the Droids sdcard in Windows?
The sdcard can be seen due to the native drivers in Windows, which is just like plugging in a flash drive and nothing more. But for adb we need a specific driver for proper communication.
It's called Android Composite ADB Interface, without it, adb will not see your Droid.
What we downloaded from Motorola provides this.
The file downloaded is a zip file, double click it and drag out the file to the desktop. Double click on it to install the drivers.
At this point adb is ready for you to use!
Making it a little easier
As we stand at this point, adb can be used.
ADB is used through Windows Command Prompt, it's like the old days of DOS but in Linux flavor.
As it is now to get adb going, you would open the Command Prompt window and cd(change directory) to the directory(folder) where adb is and type the adb shell command.
To avoid all this typing, and get to the shell quicker, we're going to add it to our path in Windows, so all we have to type when in the Command Prompt window is adb shell.
To do this, we need to get to the System Properties in Windows.
It's basically the same in XP, Vista, and Windows 7.
There's two simple ways to get there:
1 way = click Start > Control Panel > System icon.
2nd way = click the Start button, right-click “My Computer”(Computer for Vista/7) and select “Properties”.
If your using XP, your there. If your using Vista/7, click on Advanced system settings on the left side.
You should now be in the System Properties window.
Click on the Advanced tab.
Click on the Evironment Variables... button
In the System variables(lower box), scroll through the list until you see Path under the Variable column.
Click on it to highlite it, click on the Edit... button.
We are going to add our path to adb, where we installed the SDK, in the Variable value: box.
Make sure your cursor is at the end of the last entry, and type this:
Be sure not to have any spaces!
(If your local drive isn't C: then just use the letter of your drive instead of C: )
Click OK on everything, and close Control Panel if it's open.
Now to use adb, at the prompt we only need to type in adb shell
That's it, you now have adb and it's ready to use!
Using adb with our phone
We need to set it up our phone so it will communicate with adb.
Don't worry, it's easy
On the phone hit the Menu button, go to Settings, go to Applications, go to Development, check the USB debugging check box.
Plug phone in to PC,
in XP - Click Start > Run > type CMD > click run.
in Vista/7 - Click Start > type in the Search program and files bar CMD > click on cmd.exe
You should now see a Command Prompt window (DOS box)
type adb shell
You are now using adb on your phone and start typing those commands!
If you get a message on the lines of ",,not an internal command,,," Then go over the steps above in the "Let's make it a tad easier to use though" section.
A couple little side notes:
First, When using adb, it's not a good idea to have your sdcard mounted on phone.
e.g. Check the USB debugging box, plug phone in, now at this point if you where going to transfer pictures or whatever, you would bring down the notification shade and press USB connected and then mount, Don't do this if your going to use adb.
If you plan on using su, your phone must be rooted.
Second, For the most part when we see the commands to mod/hack our Droids, they usually start out:
mount -o rw,remount,,,blah, blah, blah
I think it's because it's just assumed that your already in the adb shell
So, just remember, you need to start the shell first:
mount -o rw,remount,,,blah, blah, blah
Push and Pull
When pushing and pulling files with adb, we DON'T use adb shell. We have to cd(change directory) to the sdk tools folder.
The tools are at C:\android\tools, so at the command prompt type:
Too push files, copy the files to the tools folder on the PC.
We'll use two files as an example, at the command prompt type:
adb push recovery-0.99.2b.img /sdcard < this copies recovery-0.99.2b.img to the sdcard in phone
adb push bootanimation.zip /data/local/ < this copies bootanimation.zip to /data/local/ on the phone
Pulling files is the same concept.
Example to pull an image file from sdcard:
adb pull /sdcard/image.jpg image.jpg < pulls image.jpg to c:\android\tools folder
Say you have a modified image, of the same one your going to pull, in the tools folder and you don't want to overwrite it.
adb pull /sdcard/image.jpg image.bak < pulls image to c:\android\tools folder and renames it
Oh, one more thing, when your finished using adb, and ready to use your Droid normally, type exit at both the # and $ to completely clear the pc from the phone and remember to un-check the USB debugging box on your phone.
I hope this will help others out there and hopefully bring a little more understanding to the modding/hacking of our Droids.