How-To: adb for Windows, made easy?

Discussion in 'Android Hacks and Help' started by mrZoSo, Dec 23, 2009.

  1. mrZoSo
    Offline

    mrZoSo New Member

    Joined:
    Dec 9, 2009
    Messages:
    412
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    GA from Philly PA
    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.

    Preparation
    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

    SDK Installation/Setup

    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:
    C:\android-sdk-windows

    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:
    C:\android

    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.
    Done.

    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:
    ;C:\android\tools\
    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.
    Done.

    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:

    su
    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:

    adb shell
    su
    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:

    cd \android\tools

    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'm done
    I hope this will help others out there and hopefully bring a little more understanding to the modding/hacking of our Droids.

    ~Peace
    Last edited: Jun 17, 2010
  2. bishop7262
    Offline

    bishop7262 New Member

    Joined:
    Dec 13, 2009
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    0
    which pc charging driver am i suppose to download for windows 7 32 bit OS?

    PC Driver 1 (W370, W375, W376g, W377) or

    PC Driver 2 (W216, W230, W230x, W23x, W259, W270, W270x, W27x, W388, W396, W397, W397v)
  3. mrZoSo
    Offline

    mrZoSo New Member

    Joined:
    Dec 9, 2009
    Messages:
    412
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    GA from Philly PA
    You don't need the charging drivers, Windows native drivers take care of that. You only need to get the 32bit version of the Motorola Mobile Phone USB Drivers.
  4. JhankG
    Offline

    JhankG New Member

    Joined:
    Nov 1, 2009
    Messages:
    3,098
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Summerfield, NC
    I'm on a Mac, so I'm not sure if you will be able to help me or not. I placed the SDK folder in my "Macintosh HD" and then in a folder named "Android". What will the path be that I type before "adb devices"?
  5. rican408
    Offline

    rican408 New Member

    Joined:
    Nov 9, 2009
    Messages:
    110
    Likes Received:
    0
    Trophy Points:
    0
    thank you!!!! i think all i needed was the drivers..... i couldent get anything to work the way they are in the tutoirals......
  6. mrZoSo
    Offline

    mrZoSo New Member

    Joined:
    Dec 9, 2009
    Messages:
    412
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    GA from Philly PA
  7. mrZoSo
    Offline

    mrZoSo New Member

    Joined:
    Dec 9, 2009
    Messages:
    412
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    GA from Philly PA
    Yeah, I seen alot of people have adb ready but getting no devices seen when they adb, and missing drivers is usually the cause.
    I was in the same boat kind of, I basically had to check out multiple tutorials and sort of piece everything together to get adb to work. That's one of the reasons I wrote this.
    I'm glad it helped you out.
  8. bishop7262
    Offline

    bishop7262 New Member

    Joined:
    Dec 13, 2009
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    0
    So I think I got it now. It shows a $ sign...
    So if I were to start to enter in adb shell it would go something like...
    $su
    mount -o rw,remount,,,blah, blah, blah

    right?
  9. mrZoSo
    Offline

    mrZoSo New Member

    Joined:
    Dec 9, 2009
    Messages:
    412
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    GA from Philly PA
    like this:

    adb shell
    your prompt will look like $
    su
    prompt turns to # , you now have root
  10. Bear in NM
    Offline

    Bear in NM Active Member

    Joined:
    Nov 12, 2009
    Messages:
    1,389
    Likes Received:
    1
    Trophy Points:
    38
    MrZoSo,

    Nice write-up and not much to add. As a matter of fact this is more of a subscription so I can link to this post, as you have covered Alquimista's thread that I had been linking to for the adb queries. The only little nit to add would be that when I am done with whatever I am doing with SU in the command prompt, I like to type exit at both the # and $ to completely clear the pc from the phone. I am somewhat sure it is not necessary, but I am not 100% sure, and it would not be needed if your shell session reboots the phone.

    I sure wish the moderators here would consider stickying some of these. We had a discussion in a thread with Rintin who concurred that the powers to be are not keen on stickying things like root, rom and other brickable offenses, but ADB and SDK are moto/vzw approved, are not changing daily. Surely an adb sticky would not be out of line.

    Craig
  11. phone
    Offline

    phone New Member

    Joined:
    Dec 12, 2009
    Messages:
    189
    Likes Received:
    0
    Trophy Points:
    0
    Nice write up. +1 on the sticky. I think this would help a lot of people who need the basics.
  12. mrZoSo
    Offline

    mrZoSo New Member

    Joined:
    Dec 9, 2009
    Messages:
    412
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    GA from Philly PA
    thanks everyone.
    @Bear in NM, I added your bit of info ;)
  13. JhankG
    Offline

    JhankG New Member

    Joined:
    Nov 1, 2009
    Messages:
    3,098
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Summerfield, NC
    Can anyone out there make a write up on adb made easy on a Mac?
  14. mrZoSo
    Offline

    mrZoSo New Member

    Joined:
    Dec 9, 2009
    Messages:
    412
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    GA from Philly PA
    I've been keeping my eye out but haven't come upon one yet.
  15. Miphesto
    Offline

    Miphesto New Member

    Joined:
    Dec 26, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    mrZoso,
    Amazing Tutorial! The only thing I was missing was the drivers. Thank you! Works amazingly now!
  16. mrZoSo
    Offline

    mrZoSo New Member

    Joined:
    Dec 9, 2009
    Messages:
    412
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    GA from Philly PA
    @JhankG, this is what I found so far:
    Mac OS X
    First you will need to download the Android SDK pack .zip archive, the same link in my OP takes you to the package for Macs as well, once downloaded find a suitable installation location on your machine and extract the zipped files.

    Please note: This installation location will be referred to as $SDK_ROOT from now on through this tutorial

    Alternatively you can add /tools to your root path which will prevent the need to specify the full path to the tools directory along with enabling you to run Android Debug Bridge (adb) along with other command line tools.


    In the home directory locate the .bash_profile and locating the PATH variable add the location to your $SDK_ROOT/tools folder.

    Now you should be able to open a terminal and type adb shell to access it, of course when the phone is plugged in and in debug mode.


    @Miphesto, Thank You, I'm glad it helped you out ;)
  17. Linux_Fan
    Offline

    Linux_Fan New Member

    Joined:
    Dec 27, 2009
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    Great Write up for Windows! I wish there was one for Ubuntu. I have followed the instructions off the android developers web page, got the SDK installed and updated however adb shell tells me I do not have permission and when I run adb devices I get ???????????. The phone is rooted properly and I can adb in windows..
  18. phone
    Offline

    phone New Member

    Joined:
    Dec 12, 2009
    Messages:
    189
    Likes Received:
    0
    Trophy Points:
    0
    I don't remember the exact command OTTOMH, but make sure you start adb as root. You don't have to use it as root, just start it. The start/stop commands are listed when you run, "$ adb"
  19. reWired
    Offline

    reWired New Member

    Joined:
    Nov 20, 2009
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    The Queen City, OH
    Great writeup mr ZoSo, this really helped me get setup. Now all I have left to do is learn how to use it.

    Thx
  20. mrZoSo
    Offline

    mrZoSo New Member

    Joined:
    Dec 9, 2009
    Messages:
    412
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    GA from Philly PA
    Glad it helped you reWired!
    Happy Droiding,,heh
Search tags for this page

adb for windows

,

adb shell download windows

,
adb shell on windows
,

adb shell windows

,

how to install adb on windows 7

,

how to open adb command prompt

,

how to use adb

,
how to use adb on windows 7
,
how to use adb shell
,

how to use adb shell on windows 7

,
how to use adb windows
,

windows adb shell