[noob-read] adb and fastboot. What is it? How can it help you?

Search This thread

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
why when i test my adb it say 'adb is not recognized as an internal or external command,operable program or batch file' . i already install my adb and fastboot using the guide post by @Chromium . anyone can help ?

Sent from my Nexus 5 using XDA Free mobile app

Because you need to add it to your environment variables. See post 1. it contains all you need to know
 

rah94

Member
Jan 6, 2015
30
1
already done it . still the same . or should i install the universal naked driver ?

Sent from my Nexus 5 using XDA Free mobile app
 

rah94

Member
Jan 6, 2015
30
1
i follow ur step just now . when i test it say :
*daemon not running . starting it now on port 5037 *
*daemon started succesfully*
List of devices attached

is it ok ? btw,my location of adb.exe is c:/adb/adb.exe

Sent from my Nexus 5 using XDA Free mobile app

---------- Post added at 05:04 PM ---------- Previous post was at 04:27 PM ----------

hey,if i wish to redo the installation, should i unistall the driver ?

Sent from my Nexus 5 using XDA Free mobile app
 

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
i follow ur step just now . when i test it say :
*daemon not running . starting it now on port 5037 *
*daemon started succesfully*
List of devices attached

is it ok ? btw,my location of adb.exe is c:/adb/adb.exe

Sent from my Nexus 5 using XDA Free mobile app

---------- Post added at 05:04 PM ---------- Previous post was at 04:27 PM ----------

hey,if i wish to redo the installation, should i unistall the driver ?

Sent from my Nexus 5 using XDA Free mobile app
That means adb is working now.

IG your device doesn't show up, then you need the drivers. No need to reinstall adb because now it is recognised
 
  • Like
Reactions: rah94

rah94

Member
Jan 6, 2015
30
1
thanks a lot . my adb n fastboot are both working . then,should i put custom recovery file and supersu file together in the abd folder ? or where should actually i put them ?

Sent from my Nexus 5 using XDA Free mobile app
 

gamer.11

Senior Member
Dec 11, 2012
508
83
Ernakulam
009.png

Was taking about this, the HTC's S-On/Off, i though you were flashing without unlocking a device. This is a screenshot screen capture from a computer.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 53
    Contents / Thread overview

    1. Introduction
    2. What is Fastboot?
    3. What is adb?
    4. How to install adb and fastboot
    5. How to test adb and fastboot work
    6. OK Gimme some useful fastboot commands please!
    7. OK Gimme some useful adb commands please!
    8. A little more about using Windows command prompt
    9. Myth Busters


    Introduction

    adb and fastboot are very useful command line tools. They can be used from Windows, Linux or Mac to carry out tasks on your android device, such as moving and backing up files, rooting and restoring your phone to it's factory state. Understanding how to use these tools could save your phone when you get yourself in trouble. This is especially true of rooted users. Particularly those of you who are "new to the scene". You definitely should read and understand this thread before you do ANYTHING root related.

    This thread is not intended to be a non-exhausted reference. It is merely here to give an overview of the most basic of basics

    line_separator_big.png


    What is fastboot?

    Fastboot comprises of 2 components.

    1) Fastboot mode on the phone (The Bootloader)
    2) Fastboot tool on your computer

    Fastboot is a small command line tool that you can use from your computer whilst the phone is connected via USB and you are booted into the bootloader. The most common uses for fastboot are:

    • Unlocking the bootloader - needed as part of the rooting process
    • Flashing a custom recovery to the device - needed as part of the rooting process
    • Flashing factory images - used for saving / trestoring your device back to stock

    Being able to do these 3 things are essential before rooting. Many new users skip learning these and use a toolkit to root. As a result, when they mess up and we try to explain what they need to do to fix their issues, it becomes very difficult for us to help as fastboot is not understood. It is YOUR responsibility to understand these things BEFORE you mess up.

    line_separator_big.png


    What is adb?

    adb is another small command line tool that stands for "Android Debugging Bridge". Again, it can be used from a computer connected via USB to your android device. It can be used whilst the device is booted into Android or (if you have a custom recovery), it can be used in recovery too, unlike fastboot (yes, adb and fastboot are NOT the same thing) which can only be used in the bootloader.

    adb can be used to push files to (or pull files from) your phone. It can also be used to execute many of the commands available in Linux terminals (Or Android terminal emulators) on the device itself. We're not here to cover all these commands however. We just want to cover the basics.

    line_separator_big.png


    How to install adb and fastboot

    adb and fastboot are very easy to install and can be installed on Windows, Linux and MAC computers. The Windows install can be a little bit more complicated than the other 2 and may need additional drivers installing too.

    Windows.

    There is a very handy tool that can install adb and fastboot in 15 seconds. It is recommended that you use this to install adb and fastboot. Please see the link immediately below for that tool:
    ADB, Fastboot and Drivers - 15 seconds ADB Installer - Really quick and easy way to install adb and fastboot (by @Snoop05). Downlkoad links are at the bottom of post 1.

    This tool asks if you want to install adb and fastboot (to which you should answer Y) and then creates c:\adb\adb.exe and c:\adb\fastboot.exe

    It then asks if you want to install it system wide (to which again, you should answer Y)... This then allows you to type adb commands in the command prompt without having to open a particular directory first. You may or may not understand what I mean when I say that, but take it from me, its much more convenient and easier to use this way.

    There is actually a manual way of doing what the 15 second installer is doing, by extracting the adb.exe and fastboot.exe to your computer and using the Windows Enviroment variable PATH to make the executables work system wide, however the installer is much quicker, but for reference:

    Code:
    right-click computer > properties > advanced > environment variables.
    
    under system variables click "path" and click "edit"
    at the end of the line, add the below:
    
    ;c:\adb_fastboot
    
    where c:\adb_fastboot is where you decided to extract adb and fastboot executables.
    
    Please note, the semi-colon ; is VERY important.

    You can do this if for some reason the installer becomes unavailable


    It will also ask if you want to install device drivers. Actually, say N to this as we're going to cover that next, using the Universal Naked driver which has better compatibility.

    Here is a link to the naked driver: DOWNLOAD THIS which has been taken from this thread:
    [ADB/FB/APX Driver] Universal Naked Driver

    Some of the below instructions are taken from the thread above by @1wayjonny but I have moved them here to make it easier for you guys.

    Code:
    To install on Windows 7:
    - Ensure existing drivers are uninstalled first*
    - Extract the zip to c:\adb (created earlier by the installer)
    - Right-click "Computer" > Manage in windows and choose "Device Manager"
    - Boot the Nexus 5 to the bootloader (Volume down + Power) and connect the USB Cable
    - Watch for any new devices with exclamation marks appearing
    - Right-Click the new device > Update driver software
    - Choose the "browse" method and browse to c:\adb then follow the wizard to the end.
    
    *To uninstall existing drivers, boot into Android and connect the USB cable.  Monitor device manager for the device showing up.  To uninstall the device, right-click it to uninstall it.  At the prompt, ensure you also choose to delete the driver.  Repeat this for bootloader and recovery.

    Code:
    To Install on Windows 8, you must additionally disable driver enforcement
    
    - From the Metro Start Screen, open Settings (move your mouse to the bottom-right-corner of the screen and wait for the - -- pop-out bar to appear, then click the Gear icon).
    - Click ‘More PC Settings’.
    - Click ‘General’.
    - Scroll down, and click ‘Restart now’ under ‘Advanced startup’.
    - Wait a bit.
    - Click ‘Troubleshoot’.
    - Click ‘Advanced Options’
    - Click ‘Windows Startup Settings’
    - Click Restart.

    Once that is done, your Windows computer is configured for adb and fastboot.

    In device manager, the device should show up as below, depending whether you are booted into recovery or bootloader...

    Recovery - Android Device > Google Nexus 4 ADB Interface
    Bootloader - Android Device > Google Nexus 4 Bootloader Interface

    If it shows as something different, either you have existing drivers in the way or something went wrong.

    Linux and Mac

    Here is a really simple tool to install adb and fastboot on the above OS. The only expectation is you know how to open and run a terminal command. Please see the link immediately below:
    Nexus Tools 2.2 (Featured by XDA) - adb and fastboot installer for Linux and Mac (by @corbin052198)

    Once you have installed adb and fastboot from the above link, you're ready to go.

    line_separator_big.png


    How to test adb and fastboot work

    As previously mentioned, adb and fastboot are both command line tools. That means you must run these tools from command prompt (cmd in Windows) or Terminal (Linux and Mac).

    Remember earlier, I mentioned that fastboot can only be used in bootloader? and adb can only be used in Android (or custom recovery - lets cover that later)? We can use the command "fastboot devices" and "adb devices to see if we have adb and fastboot working correctly.

    Lets try it.
    1. Boot your phone into android
    2. Connect it to your computer via USB
    3. Open cmd (start > type "cmd" on Windows) or Terminal (Mac/ Linux
    4. Type in the windows "adb devices" and press enter

    Here is what we don't want to see:

    cmd1.png


    Notice how there is nothing underneath where it says "List of attached devices" That means it cannot see any device

    Here is what we DO want to see:

    cmd2.png


    We can see that there is now a device listed.

    OK lets test fastboot. Unplug the USB and turn off the phone. When it is off, hold down Volume down + power until you feel the vibrate. You will now be in the bootloader. Reconnect the USB cable.

    In the same window (cmd or terminal) we're going to now type "fastboot devices".

    Again, here is an example of what we don't and do want to see:

    cmd3.png


    cmd4.png


    If in both modes, you can see your devices "Serial Number", then you know they are both working. If they're not working (mainly Windows users) you may want to check this additional thread about troubleshooting drivers.
    [*] Diagnosing USB Driver and ADB issues in Windows - Ensure ADB and fastboot WORK before you root (by @MaxRabbit)

    Please note that if you cannot get adb and fastboot to work "system wide", you can open the command prompt to the location of the adb and fastboot executables exist and try from there.

    line_separator_big.png


    OK Gimme some useful fastboot commands please!

    Here are some of the most useful fastboot commands you will come across. Fastboot is used mostly for flashing images to the devices partitions on the internal memory.

    Code:
    fastboot oem unlock
    This unlocks your bootloader and allows you to flash a recovery to root. WARNING, this will wipe your device. If you actually want to do this, please follow this guide:
    How to Unlock Bootloader, Install Custom Recovery and Root - The preferred method. Allows you to learn and understand the basics (by @Chromium)

    Code:
    fastboot flash recovery recovery.img
    This will flash a recovery.img to the recovery partition. The command is broken down into "fastboot flash" (what to do) "recovery" (where to flash to) "recovery.img" what to flash there. In the terminal or command prompt, you cannot just type "recovery.img" though. It has to be the path to where the recovery image is. For example, if my recovery image is on my desktop, I would have to type:
    Code:
    fastboot flash recovery c:\users\rootsu\desktop\recovery.img
    It is worth noting, that it IS case sensitive, meaning if your file is called Recovery.img, you must type the capital R...

    Other things you would flash:

    Code:
    fastboot flash system system.img
    fastboot flash boot boot.img

    These will flash the system image (ROM) and bot image (kernel) as you would if you were returning to stock. If you want to return to stock, please use this guide:
    How to flash a factory image | Return to stock | Unroot/SAVE your Nexus 5 - Understand how to undo whatever you do before you root (by @abaaaabbbb63)

    You can also boot into a recovery.img without flashing it...
    Code:
    fastboot boot c:\users\rootsu\desktop\recovery.img
    which is "fastboot boot" (what to do) "c:\users\rootsu\desktop\recovery.img" what to do it with. As you may have noticed, we did not define the recovery partition in this command, that's because we're not flashing it....

    line_separator_big.png


    OK Gimme some useful adb commands please!

    At the moment, we are going to assume you have a custom recovery and you have booted into recovery. The reason for this is using adb in recovery can be much simpler.

    Here are some useful scenarios for using adb.

    Backup your sdcard to your PC

    Code:
    adb shell
    mount data
    exit
    adb pull data/media/0 c:\MyBackup

    **Please note, some recoveries may "mount data" automatically on boot, so don't be disheartened if you get an error stating device or resource busy. This probably just means you can't mount what is already mounted**

    /data/media/0 is the real location of /sdcard for your information. Also referred to as "The mount point". What we have done here is "adb pull" (what to do) "data/media/0" (what to move) "c:\MyBackup" (where to move it to)

    Push a zip file from your PC to your sdcard (useful if you wiped your sdcard and rom)

    Code:
    adb shell
    mount data
    exit
    adb push c:\rom.zip data/media/0
    What we have done here is "adb push" (what to do) "c:\rom.zip" (what to move) "data/media/0" (where to move it to)

    You can of course also use adb to push and pull files to and from /system too. You just need to:
    Code:
    adb shell
    mount system
    exit

    I mentioned earlier that using custom recovery is much easier for adb than whilst booted into Android. You need to ensure you have a kernel that allows insecure adb before you do anything with system and data partitions. You also need to ensure that USB debugging has been enabled in developer options.

    For example, to mount system to pull files whilst android is running you have to:

    Code:
    adb root
    adb shell
    mount -o rw,remount /dev/block/platform/msm_sdcc.1/by-name/system /system
    ...which is clearly a little bit more involved, so I recommend you use recovery for adb push and pull. You can find more detailed information on adb here: http://developer.android.com/tools/help/adb.html


    line_separator_big.png


    A little more about using Windows command prompt

    One thing to understand is that like Windows, command prompt (cmd.exe) works with directories (or folders if you like). The Linux and Mac terminals are the same, but most linux users, we expect you would already know this.

    Here you will see I have downloaded a recovery image that I want to flash using fastboot.

    001.png


    As you can see, the recovery.img is located in C:\users\rootSU\Desktop

    002.png


    Usually when you open the command prompt from the start menu, or run command, the command prompt will default to your user location as seen below:

    003.png


    So lets try and fastboot flash recovery recovery.img...

    004.png


    It fails with a not-too-accurate error message. It has failed because you have not told it where the recovery image is. It assumes it is in the directory as listed in the prompt

    005.png


    So, how do we deal with this? Well, there are 3 ways.

    1) We tell the command prompt where the recovery.img actully is in the command itself

    007.png


    Success! As you can see, we have told the command that the location for the file is Desktop\recovery.img

    008.png


    2) We can change the directory in command prompt to the directory where the file is. In this example, we change directory to "Desktop". The change directory command is "cd " or in this case "cd Desktop"

    009.png


    3) ...and possibly the simplest method. We hold shift whilst we right-click on the folder we want to change directory to, and directly open a command prompt there:

    10.png


    Another point to make with command prompt or terminals, is if you do a particular command, it is "pre-programmed" to "expect" a particular format of that command.

    For example, we know that adb push as a command expects after it . This means the command is actually
    Code:
    adb push
    BUT if you put something AFTER , for example -
    Code:
    adb push   somethingelse
    , it will assume that the "somethingelse" is a bad parameter, and the command will fail. It will probably display (or "print" which is the technical term in a terminal) a helpful guide of how the command should be used instead of trying to run the command which it does not understand.

    You're probably wondering why I am telling you this. Well quite simply, it is a warning about folder names. Imagine you have c:\users\rootSU\My Documents as a folder. You assume the command is then
    Code:
    adb pull /data/media/0 c:\users\rootSU\My Documents
    but it is not... There is a space in between My and Documents. What you have actually done is
    Code:
    adb pull   Documents
    because it uses a space to signify the end of a command or parameter. It is best to avoid using folders with spaces in them. Avoid as much as you can. In the event it is unavoidable (Although when is it ever>) then please surround the path with quotation marks,
    Code:
    adb pull /data/media/0 "c:\users\rootSU\My Documents"
    so that way, it sees everything between the " " as a single parameter.

    line_separator_big.png


    Myth Busters

    Myth 1: You need USB debugging on to use adb and fastboot

    If you cannot boot into Android, it doesn't matter. You DO NOT need USB Debugging turned on to use adb outside of android. USB Debugging is an Android ONLY setting. Fastboot obviously also does not need debugging either as this too is outside of Android

    Myth 2: to adb push or fastboot flash files, they must be in the same folder as adb or fastboot executables. Sorry but this is rubbish. You can pass the full path of the image you're flashing or file you're pushing in the command and fastboot / adb can be called system wide if you've set them as an environment variable or used the 15 second installer
    6
    wonderful(really wonderful)!

    but i cant find the start button on this toolkit.. :silly:
    2
    wonderful(really wonderful)!

    but i cant find the start button on this toolkit.. :silly:
    How do I flash the toolkit? I think its bricked :silly:

    Good thread.
    2
    Thanks for listing my Nexus Tools :)
    2
    I suggested to the mods that we have just one sticky in general that has all the threads we believe to be Stickies within it. That way we can control it ourselves but without making it messy, so we have that now ( see signature).

    Sent from my Nexus 5 using Tapatalk