[GUIDE] ADB for Noobs - How to get adb working !

Search This thread

steviewevie

Retired Forum Moderator
Oct 28, 2009
5,333
616
UK
I have tested and uploaded a Mini ADB package and the ADB USB drivers for Windows Vista / Windows 7, to the Resources Centre, easy tutorial + FAQs thread here:
http://xdaforums.com/showthread.php?t=835777

I thought this would make things easier for newbies or people who don't want to download the whole SDK / Sync software

Now linked in my first posting, thanks :)

"Method B", the "quick" way to run adb (no downloading of the whole SDK) is now complete in the first posting too.
 
Last edited:
  • Like
Reactions: demkantor

gtrab

Senior Member
Aug 10, 2007
2,973
512
America
Cool.

It's good to encourage new users to learn some basic ADB
I have cross linked this tutorial from the Easy + FAQs for dummies thread too
 

siedkins

Senior Member
Jul 3, 2008
295
78
London

steviewevie

Retired Forum Moderator
Oct 28, 2009
5,333
616
UK
Hi guys,
I've just written a guide on how to install ADB on a Mac and also cut out the need to navigate into the SDK folder to run ADB each time you want to run it.

Please take a look and let me know what you think. I'd be more than happy to merge the guides if you wanted but let me know!

http://xdaforums.com/showthread.php?p=9842005

That looks great. Would you be happy if I plagiarise your guide for the "how to install" bits on Mac, and give you full credit (of course) in my posting ?

I could just cross-link but I'd rather have all the stuff in one thread here if that's ok with you (if not I won't do it).
 

siedkins

Senior Member
Jul 3, 2008
295
78
London
That looks great. Would you be happy if I plagiarise your guide for the "how to install" bits on Mac, and give you full credit (of course) in my posting ?

I could just cross-link but I'd rather have all the stuff in one thread here if that's ok with you (if not I won't do it).

Yes that's fine - copy the info but if you can say it was me and maybe link somewhere to my thread or hyperlink my name or something.

That's why I posted it up here to spread the knowledge !!!!
 

djfoo000

Senior Member
Jan 26, 2010
274
30
a small question. When it prompts on the phone to select a mode, which mode should we select? Charge or disk drive? I put it in 'Charge' and the phone serial number came out nice after input 'adb devices', but wasn't sure if I'm doing right.
 
  • Like
Reactions: sman234

steviewevie

Retired Forum Moderator
Oct 28, 2009
5,333
616
UK
a small question. When it prompts on the phone to select a mode, which mode should we select? Charge or disk drive? I put it in 'Charge' and the phone serial number came out nice after input 'adb devices', but wasn't sure if I'm doing right.

Best to put it in "charge only" because if you put it into "disk drive" mode, you won't be able to push anything to the SD card if you try (because that will be mounted on the PC, not the phone).

It shouldn't really matter in terms of being to see the phone though.
 

steve_ding

Member
Jan 24, 2007
13
1
ADB device not found

Hi guys,
Been doing lots of reading since my attempt to permroot my G2 last night using Visionary failed and the phone is stuck on the HTC logo screen when booting up. Still S-ON and I can get into the stock recovery ok. Tried to recover using the stock ROM but since it doesn't contain the OTA updates, it won't let me overwrite/downgrade it. So seems like my best bet is to get ADB working and then follow the procedure on that thread about dealing with semi-bricked G2. I'm comfortable with UNIX and the instruction seems to make sense but I haven't got ADB to recognize my phone yet. I have full Android SDK installed and have tried both HTC sync and ADB_HTC_Drivers_Win.zip I found on this site. In my Device Manager, (Win 7 64-bit) I do see the phone as My HTC under Android USB Devices but "adb devices" returns nothing. Now at this point, my phone is in recovery screen connected through USB, and "fastboot devices" returns the serial number for the phone. I've been pulling my hair out trying to get ADB to see my G2 and have installed/reinstalled/manually updated the drive quite few times to no avail. Any idea on how to proceed?
Thanks in advance. You guys are pretty awesome.
Steve
 

steve_ding

Member
Jan 24, 2007
13
1
Hi guys,
Been doing lots of reading since my attempt to permroot my G2 last night using Visionary failed and the phone is stuck on the HTC logo screen when booting up. Still S-ON and I can get into the stock recovery ok. Tried to recover using the stock ROM but since it doesn't contain the OTA updates, it won't let me overwrite/downgrade it. So seems like my best bet is to get ADB working and then follow the procedure on that thread about dealing with semi-bricked G2. I'm comfortable with UNIX and the instruction seems to make sense but I haven't got ADB to recognize my phone yet. I have full Android SDK installed and have tried both HTC sync and ADB_HTC_Drivers_Win.zip I found on this site. In my Device Manager, (Win 7 64-bit) I do see the phone as My HTC under Android USB Devices but "adb devices" returns nothing. Now at this point, my phone is in recovery screen connected through USB, and "fastboot devices" returns the serial number for the phone. I've been pulling my hair out trying to get ADB to see my G2 and have installed/reinstalled/manually updated the drive quite few times to no avail. Any idea on how to proceed?
Thanks in advance. You guys are pretty awesome.
Steve
A little bit more info here:
When I'm on the main hboot menu, "adb devices" returns nothing and "fastboot devices" returns my G2 correctly. When I'm in stock recovery, looking at that triangle with exclaimation point, "adb devices" returns my G2's serial number but says it's offline. I have tried couple of computers with Windows 7 and XP, couple of USB cables with different ports and got the same results every time.
Any ideas? Thanks!
 

eneka

Senior Member
Dec 10, 2010
158
32
Hacienda Heights
I'm having some trouble connecting my G2 to my computer. I noticed that HTCSync doesn't seem to support the G2 as it can't detect the phone, and when I plug the usb in, it just asks me if I want to mount my mem card to the computer. USB Debugging is also on. When I try to execute the ADB commands, it just tells me device not found.
I'm running Win 7 64bit.
 

steviewevie

Retired Forum Moderator
Oct 28, 2009
5,333
616
UK
A little bit more info here:
When I'm on the main hboot menu, "adb devices" returns nothing and "fastboot devices" returns my G2 correctly. When I'm in stock recovery, looking at that triangle with exclaimation point, "adb devices" returns my G2's serial number but says it's offline. I have tried couple of computers with Windows 7 and XP, couple of USB cables with different ports and got the same results every time.
Any ideas? Thanks!

I don't think you can get into adb when the phone is in hboot, you can use fastboot for that. Probably the same for stock recovery, though I'm not sure.

In stock recovery (the exclamation mark), can you press volume Up and Power and get into the actual stock recovery screen ? If so, you may be able to do a factory reset.

Or if you can get into fastboot then you have the possibility of flashing the ROM image again.

However, probably best to post this in another thread, or start one in the Q&A section.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 30
    A lot of people seem scared to use "adb" (Android Debug Bridge), or try it out and hit problems, then immediately give up.

    I personally think that the method of rooting using adb (rage) is "better" than Visionary, because you have more control over the process and can see what it's doing. e.g. if there's an error message then you can see that, and ask for help.

    But even if you don't use adb in rooting, it's still a very useful tool to have available. You can use it to run commands on your phone, copy files between your PC and phone, and to debug various issues that may occur at some point (plus lots more).

    The guide in this first posting is for Windows, since I think this is what the majority of what people are using, and also it's what I use myself. Though you can use adb on Linux or Mac too. There's a Mac guide in the second posting, with a Linux guide "coming soon".

    There are different ways to install adb. Below I list two methods, the first method I call "Complete", which involves installing the Android SDK (Software Development Kit), and the second "Quick" way. Either should be fine for rooting etc.

    There's also a guide by gtrab in his useful FAQ posting (thanks !) HERE , which involves a very quick way to get it up and running (scroll down to the "Adb Mini Package" section).


    INSTALLING ADB ON WINDOWS - METHOD A, THE "COMPLETE" WAY, USING THE SDK

    Step 1

    If you haven't done so already, then download and install HTC Sync from HTC's website.

    You'll find it in the Support section for the Desire Z (works on the G2 too), e.g. at http://www.htc.com/www/help/htc-desire-z/#download.

    This is HTC's software to sync various stuff from your phone to your PC, such as email, bookmarks etc. However, even if you don't need that stuff, HTC Sync has a bunch of USB drivers for your phone, and that's what we *do* need.


    Step 2

    Download and install the Android SDK (Software Development Kit) Starter package from http://developer.android.com/sdk/index.html

    There are two choices for Windows there, a simple zip file which you can unzip somewhere appropriate on your PC (e.g. put it on C:\ if you like). Or there's an installer (which is the recommended option according to the Android website), though that forces you to download some Java stuff which we don't really need for adb and takes a lot longer to install (but there won't be any harm in getting). It doesn't really matter which one you pick though.

    You can read all about how to install the SDK at http://developer.android.com/sdk/installing.html . Ignore all the stuff about Eclipse though, you don't need that unless you're going to start writing Android apps.


    Step 3

    Now we need to add the Platform Tools component to the SDK, because that contains adb.

    Run "SDK Manager" on your PC. You will find that in the root directory of the SDK, so you can open up a file explorer window to find that, then double-click on "SDK Manager" to run it.

    Wait for a few seconds while it checks on the Android website for updates etc, let it then pop up with a window showing you what is on offer.

    Add the "Android SDK Platform Tools", you can "reject" (i.e. don't install) all the other things it offers you if you like, though there's no harm in installing them (just takes up disk space on your PC).


    Step 4

    Now we need to update your Path variable. This lets you run adb on your PC from a command window no matter which directory you are in (which makes things a lot easier). If you don't setup your Path, then every time you want to run adb, you will either have to type the whole long pathname where you put adb, or cd to where you've put adb and run it from there (which could be inconvenient if you are transferring files to/from your phone).

    On your PC, right-click on "My Computer" and select "Properties". (on Vista, click on "Change Settings"). Go to the "Advanced" tab, then select "Environment Variables". Find the "Path" variable in the list of variables that it shows (you might need to scroll), and then double-click on that entry to edit it. Add the full path of the "tools" and "platform-tools" folders of the SDK to your path. e.g. if the SDK has been installed in "c:\Program Files\android-sdk-windows", then add to your Path "c:\Program Files\android-sdk-windows\tools;c:\Program Files\android-sdk-windows\platform-tools" (Please Note - don't put any spaces between the semi-colon and pathname, otherwise it won't work !)


    Step 5

    On your phone, go into Menu->Settings->Applications->Development and make sure you have the entry "USB Debugging" ticked. adb will not work without this.


    Step 6

    Plug your phone into your PC using the original HTC cable. This is important, do not use a third-party cable since it might not work with adb (even though it might seem fine with other communication with your phone). If this is the first time you've done it since installing HTC Sync, you might have to wait while it installs additional drivers.


    Step 7

    Fire up a command prompt on your computer, e.g. "Run" then "cmd", or pick the "Command prompt" option from the menus, and type in the following (obviously the C:\> bit is your actual PC's prompt, not what you type). To emphasise, you are running this on your PC, not directly from your phone (e.g. terminal emulator) :

    Code:
    C:\>  adb devices
    This should display something like the following :

    Code:
    List of devices attached
    XXX12345    device
    ... where the "XXX12345" bit is actually your phone's serial number. If the list is blank and the phone is plugged in ok, go back to Step 5 and make sure USB Debugging is enabled. If you can see your phone, then you're in business, adb can see your phone and communicate with it, and you're ready to start using adb !

    By the way, the first adb command that you type may well also come up with some lines similar to "adb deamon out of date" etc, but don't worry, that's normal, just check the rest of the output.



    INSTALLING ADB ON WINDOWS - METHOD B, THE "QUICK" WAY, NO SDK

    Thanks to amroush_1800 for the input on this.

    Step 1

    If you haven't done so already, then download and install HTC Sync from HTC's website.

    You'll find it in the Support section, e.g. at http://www.htc.com/uk/supportdownloadlist.aspx?p_id=325&act=sd&cat=all.

    This is HTC's software to sync various stuff from your phone to your PC, such as email, bookmarks etc. However, even if you don't need that stuff, HTC Sync has a bunch of USB drivers for your phone, and that's what we *do* need.


    Step 2

    Download this zip archive and unzip it somewhere memorable on your PC (e.g. into a folder on your desktop) - http://dl-ssl.google.com/android/repository/platform-tools_r04-windows.zip


    Step 3

    On your phone, go into Menu->Settings->Applications->Development and make sure you have the entry "USB Debugging" ticked. adb will not work without this.


    Step 4

    Plug your phone into your PC using the original HTC cable. This is important, do not use a third-party cable since it might not work with adb (even though it might seem fine with other communication with your phone). If this is the first time you've done it since installing HTC Sync, you might have to wait while it installs additional drivers.


    Step 5

    Fire up a command prompt on your computer, e.g. "Run" then "cmd", or pick the "Command prompt" option from the menus.

    Use the "cd" command to change to the folder that contains the adb.exe and other files that you unzipped in Step 2.

    Then type in the following (obviously the C:\> bit is your actual PC's prompt, not what you type). To emphasise, you are running this on your PC, not directly from your phone (e.g. terminal emulator) :

    Code:
    C:\>  adb devices
    This should display something like the following :

    Code:
    List of devices attached
    XXX12345    device
    ... where the "XXX12345" bit is actually your phone's serial number. If the list is blank and the phone is plugged in ok, go back to Step 3 and make sure USB Debugging is enabled. If you can see your phone, then you're in business, adb can see your phone and communicate with it, and you're ready to start using adb !

    By the way, the first adb command that you type may well also come up with some lines similar to "adb deamon out of date" etc, but don't worry, that's normal, just check the rest of the output.
    5
    INSTALLING ADB ON MAC

    The following excellent guide kindly provided by siedkins, please thank him and not me !

    What you will need:
    A Mac
    USB cable
    Android SDK for OSX- http://developer.android.com/sdk/index.html

    At the time of writing this the version was "android-sdk_r08-mac_86" so please have a look at the above link and let me know if you can't find that same version.

    So download the zip file and I would extract it to a folder where you are happy to keep it such as within your user home folder i.e. Macintosh HD/Users/{Your User Name} and for my mac it is Users/siedkins which is how I have my OSX set up.

    Then open then still in Finder, open "android-sdk-mac_86" then "tools".

    Now launch Terminal - ⌘ + space then type Terminal or Applications>Utilities>Terminal

    Now drag and drop the file called "android" in the "tools" folder into your terminal window and you should see something like:
    /Users/siedkins/android-sdk-mac_86/tools/android

    Then hit enter - this should load Android SDK

    Next go to Available Packages on the left and Android Repository > Android SDK Platform-tools, revision 1 -tick the box and hit "Install Selected"

    It should download and install the Platform Tools which includes ADB !!!!

    Now quit Android SDK after it has downloaded and go back into Finder. Now you should see a new folder "platform-tools" in the "android-sdk-mac_86" folder. Open that and you can now see a file called adb.

    Now .... I am going to show you how to make your life a lot easier in Terminal to run ADB without having to navigate to the folder every time you want to launch it.

    Go back to your Terminal window and type (or copy & paste):

    Code:
    cd ~

    The screen should then look like
    NAME_OF_YOUR_MACHINE:~ USERNAME$

    For me I have:
    Mac-Pro:~ siedkins$

    Next, type

    Code:
    touch .bash_profile

    to create your new bash / path file

    Next, type

    Code:
    open -e .bash_profile

    to open it in TextEdit.

    Now into Text Edit please copy:

    Code:
    export PATH=${PATH}:

    Then go into Finder and navigate your your "android-sdk-mac_86" folder. Then click on the "platform-tools" folder and drag and drop this into TextEdit at the end of the code above that you copied. Mine looks like:
    export PATH=${PATH}:/Users/siedkins/android-sdk-mac_86/platform-tools/

    Yours should look like:
    export PATH=${PATH}:insert your path to the "platform-tools" folder in your Android SDK here

    All you need is that one line. Then Save and exit TextEdit and then very importantly QUIT TERMINAL.


    Now ........ to turn on USB Debugging in your handset Settings > Applications > Development > USB Debugging - ticked and also go to Settings > Connect to PC > Default connection type > Charge Only and also UNTICK "Ask me ..." there also. You can always go back here and change these settings back.

    Now plug in your phone to a USB port. I noticed that if I plugged my phone into one of the standard USB ports on the front of my machine I couldn't see the phone further down the line and if I plugged it into a powered USB port on the front (I have an "akasa AK-ICR-08" which has a powered connector behind the 5 USB ports. But you guys will probably be using a MacBook or MacPro and there shouldn't be any issues with the power to your USB ports.

    Now to launch ADB - re-open terminal (remember that you had quit it - very important!) then type in:

    Code:
    adb devices

    And you should see:
    List of devices attached
    HXXXXXXXXXX device

    where XXXXXXXX is your unique phone ID.

    Now you can run all of your favourite ADB commands straight by typing:
    adb shell

    etc straight into Terminal. I won't go into that here as there are plenty of guides about what to do with ADB once it's installed!



    Now you have ADB setup on your Mac and can run it without the need for installing HTC Sync - un-installing it - loading some modified drivers over the top !!!!

    It all just works !!!!!!


    INSTALLING ADB ON LINUX

    Coming soon ...
    4
    USING ADB

    There's a comprehensive guide to using adb, including all its commands, at http://developer.android.com/guide/developing/tools/adb.html

    Here are a few example commands :

    Code:
    C:> adb push hello.txt /data/local/tmp
    The above copies the file hello.text from the current directory of your PC (i.e. the directory shown in the command prompt) into the /data/local/tmp directory on your phone.


    Code:
    C:\> adb pull /sdcard/error.log error.log
    The above copies the file /sdcard/error.log onto your PC.


    Code:
    C:\> adb install Superuser.apk
    The above installs the app in the Superuser.apk file in the current directory of your PC, onto your phone.


    Code:
    C:\> adb shell
    The above starts a command prompt session on your phone. So when you see the $ prompt, that's your phone and commands you type there will be executed on your phone.


    Code:
    C:\> adb shell ls
    The above runs the command "ls" on your phone and displays the results. So it's a way of issuing one command at a time, without starting your own shell session. You can subsitute other shell commands for the "ls".


    Code:
    C:\> adb reboot
    The above reboots the phone.


    Code:
    C:\> adb reboot bootloader
    The above reboots the phone into the bootloader (hboot).


    Code:
    C:\> adb reboot recovery
    The above reboots the phone into recovery.




    USING ADB FOR DIAGNOSTICS (logcat)

    Coming soon ...
    1
    Thank god! Lol thanks for all your hard work.

    Sent from my HTC Vision using XDA App
    1
    Get a "how to logcat" section added.

    Thanks for the suggestion, will do :)