Related
Hello All!
After much frustration with setting up ADB i finally got it working. Everyone said its simple and takes minimal knowledge but when things dont work, nothing really worked. Anyways after 2 hours of research trying to get ADB to work i finally got it all working and wanted to share my knowledge to anyone else that needed help.
This Guide is for windows only. If you are using Mac OS X please go here: ADB For Dummies
If you are using Linux please go here: [HOW-TO]Set up Android SDK/ADB/Fastboot on Ubuntu Linux
Like My Guide(s)? Donate
--------------------------------------------------------------------------
Things you need:
Android SDK - Download
Winrar - Download (32bit) Download (64bit)
Windows PC
USB Cable
A Rooted HTC Dream (Google G1)
--------------------------------------------------------------------------
Setting up the Android SDK
Download the file from above
Unzip to your desktop
Take the "android-sdk-windows" folder and move it to the root of your hard drive (C:\)
Right click on My Computer and click properties
Select the Advanced Tab or Advanced System Setting (Vista/Windows 7)
Select Environment Variables...
Press New
For Variable Name type: adb
For Variable Value type: C:\android-sdk-windows\platform-tools
Now,
1. Run SDK Manager.exe located in the android-sdk-windows folder
2. If it gives you an error go to settings and click on "Force http//....."
3. Select all options and let it download and install
If you cant get the setup to work, Download the USB-DRIVERS folder - HERE (Windows XP/Vista/Windows 7)
--------------------------------------------------------------------------
Preparing your phone for ADB
Go to Settings on your phone
Select Applications
Select Development
Make sure 'USB Debugging' is checked
--------------------------------------------------------------------------
Installing Drivers
Plug in your phone through USB and DO NOT MOUNT IT!!!!!
Your computer should see a new device and try to install Android 1.0 driver (If it doesnt, scroll down to the "Im not getting a notification of Android ADB when i plug in my USB" section)
Let it load
Once it cant find them select "Install drivers from my pc"
The drivers you need are in the Android SDK 1.5r2 folder (C:\android-sdk-windows\usb_driver)
Depending on your OS pick x86 or amd64
You ADB Android Device should now be installed! Good Job
For Android SDK 1.5r7+
1. Run SDK Manager.exe
2. If it gives you an error go to settings and click on "Force http//....."
3. Select all options and let it download and install
If you cant get the setup to work, Download the USB-DRIVERS folder - HERE (Windows XP/Vista/Windows 7)
--------------------------------------------------------------------------
Check if your phone is detected by ADB
Open up Command Prompt (Go to run, type in cmd, press enter)
Type in
Code:
cd C:\android-sdk-windows\platform-tools === Press Enter
adb devices === You should see your device listed
adb shell === you should see # in the next line
Now you are all set to run adb commands
Note: for a list of commands type in 'adb' in cmd
CONGRATS YOU NOW HAVE ADB FULLY RUNNING!
--------------------------------------------------------------------------
Droid Explorer by Camalot
Droid Explorer is a Windows software that will download, install, and setup the android SDK for you all in under a minute so you are ready to go. I use this on a daily basis. This amazing piece of software has tons of plugins and a built in file explorer for all your files on your phone! All you gotta do is download, install, and go!
Download Droid Explorer - Here
Install the program, and let it setup the SDK files for you
Connect your phone
Enjoy!
--------------------------------------------------------------------------
"Im not getting a notification of Android ADB when i plug in my USB"
Why: Your computer has detected your phone but as a protable device and as a storage device.
Fix: This took me a lot of research and time to figure out so this is what your are going to do.
First download USBDeview - Here
Unzip it
Run USBDeview.exe as Administrator
You will see all drivers being used on your computer
Highlight and Uninstall all drivers with the description have HTC Android (Should be 3 of them)
Right Click on the driver and press uninstall
Once done, Unplug your phone and plug it back in
You should now get the notification of the ADB device
Follow the steps above to install the drivers
--------------------------------------------------------------------------
When Typing just adb in cmd you will get whats called a "usage doc" which gives you a lits of commands that you can use:
Code:
-d - directs command to the only connected USB devic
e
returns an error if more than one USB device is
present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is r
unning.
-s <serial number> - directs command to the USB device or emulator w
ith
the given serial number
-p <product name or path> - simple product name like 'sooner', or
a relative/absolute path to a product
out directory like 'out/target/product/sooner'.
If -p is not specified, the ANDROID_PRODUCT_OUT
environment variable is used, which must
be an absolute path.
devices - list all connected devices
device commands:
adb push <local> <remote> - copy file/dir to device
adb pull <remote> <local> - copy file/dir from device
adb sync [ <directory> ] - copy host->device only if changed
(see 'adb help all')
adb shell - run remote shell interactively
adb shell <command> - run remote shell command
adb emu <command> - run emulator console command
adb logcat [ <filter-spec> ] - View device log
adb jdwp - list PIDs of processes hosting a JDWP transport
adb install [-l] [-r] <file> - push this package file to the device and instal
l it
('-l' means forward-lock the app)
('-r' means reinstall the app, keeping its data
)
adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories
)
adb bugreport - return all information from the device
that should be included in a bug report.
adb help - show this help message
adb version - show version num
scripting:
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-serialno - prints: <serial-number>
adb status-window - continuously print device status for a specifie
d device
adb remount - remounts the /system partition on the device re
ad-write
adb root - restarts adb with root permissions
networking:
adb ppp <tty> [parameters] - Run PPP over USB.
Note: you should not automatically start a PDP connection.
<tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] - Eg. defaultroute debug dump local notty usepeerdns
adb sync notes: adb sync [ <directory> ]
<localdir> can be interpreted in several ways:
- If <directory> is not specified, both /system and /data partitions will be u
pdated.
- If it is "system" or "data", only the corresponding partition
is updated.
--------------------------------------------------------------------------
Commands that you should know
adb push - Insert file to phone such as Stock.apk to /data/app_s
Code:
adb push <pathtofile.apk> <file system location> - Example: adb push c:\app.apk /data/app
adb pull - Remove file from phone such as Stock.apk from /data/app_s
Code:
adb pull <pathtofile.apk> <path where you want to save it>- Example: adb pull /data/app/Stock.apk C:\
adb install - Install app to phone
Code:
adb install <path to file> - Example: adb install c:/apps/apps2sd.apk
adb uninstall - Uninstall app from phone
Code:
adb uninstall <name of application> - Example: adb uninstall linda.apk
For more ADB Commands go - Here
--------------------------------------------------------------------------
Thats it for ADB! Congrats and if you have any questions please ask me or if anything is missing or not correct please tell me. I got all of this from research and personal experience.
[GUIDE] Fastboot for Noobs
Fastboot
Like My Guide(s)? Donate
Things you need:
New SPL - Download
New Radio - Download
Your Current ROM - CyanogenMod 3.6
SD Card Reader
Rooted G1 Phone
Computer
USB Cable
Patience
---------------------------------------------------------------------------------------
Install Radio FIRST
Download the Radio Update
Rename it to update.zip
Remove your SD Card from your phone and place it in your SD Card Reader
Put the update.zip at the root of your SDcard (root = not in any folder)
Insert your sdcard back into the phone
Turn off your phone (Hold power and press Power Off)
Hold the Home button and then press the power button (Keep holding power)
You will now enter recovery
Open up your keyboard and press Alt-S
Let it finish the update
When done reboot by pressing Home and Back
You should be able to access your Home screen (If its stuck on the Google G1 screen dont panic, just remove your battery for now)
---------------------------------------------------------------------------------------
Installing the new SPL
Note: To update you must have a PVT board. To Check go into fastboot (Power and Camera and check)
Take your SD Card out again and plug it into the pc
Remove the update.zip that you put in there
Download your current Rom or any other ROM that you want. I suggest CyanogenMod 3.6
Download the SPL Update
Rename the SPL Update to update.zip
Remove your SD Card from your phone and place it in your SD Card Reader
Put the update.zip at the root of your SDcard (root = not in any folder)
Insert your sdcard back into the phone
Turn off your phone (Hold power and press Power Off) or put your battery back in and turn it on
Hold the Home button and then press the power button (Keep holding power)
You will now enter recovery
Open up your keyboard and press Alt-S
Let it finish the update
Now it will reboot on its own back to recovery
Reboot again by pressing Home + Back
Your phone will be stuck on the T-Mobile G1 Screen (Again DONT FREAK)
Remove the battery from your phone
Remove your SD Card and plug it back into your computer
Take the ROM that you downloaded and rename it update.zip
Remove the update.zip that was on your SD Card and put this new one it
Put the battery back into your phone
Enter recovery (Home + Power)
Press Alt+s to update
Let it finish
Press Home + Back to reboot
Thats it! You now have your new SPL and Radio
---------------------------------------------------------------------------------------
Getting into Fastboot
Turn off your phone
Hold the back button and keep holding it while turning your phone back on
You should see 3 Android guys on skateboards
You should now be in Fastboot mode!
---------------------------------------------------------------------------------------
Setting up fastboot to work with your computer
Plug your phone in to your computer through USB
You should get a popup that your computer found the ADB Device for fastboot
When it asks you for drivers, make sure u select the option to locate the drivers from your computer yourself
Since you already have your Android 1.5r2 SDK installed, the drivers are in the same place where the ADB drivers are
C:\android-sdk-windows-1.5_r2\usb_driver
Make sure you choose the correct folder depending on your OS
Press ok to install the drivers
Fastboot should now be up and running
---------------------------------------------------------------------------------------
Make sure Fastboot is working
Open up Command Prompt
type the following
Code:
cd C:\android-sdk-windows-1.5_r2\tools === Press Enter
fastboot devices === Press enter, your device should be listed
fastboot shell === You should see a # in the next line
type fastboot and press enter for general commands
---------------------------------------------------------------------------------------
When Typing just fastboot in cmd you will get whats called a "usage doc" which gives you a lits of commands that you can use:
Code:
usage: fastboot [ <option> ] <command>
commands:
update <filename> reflash device from update.zip
flashall 'flash boot' + 'flash system'
flash <partition> [ <filename> ] write a file to a flash partition
erase <partition> erase a flash partition
getvar <variable> display a bootloader variable
boot <kernel> [ <ramdisk> ] download and boot kernel
flash:raw boot <kernel> [ <ramdisk> ] create bootimage and flash it
devices list all connected devices
reboot reboot device normally
reboot-bootloader reboot device into bootloader
options:
-w erase userdata and cache
-s <serial number> specify device serial number
-p <product> specify product name
-c <cmdline> override kernel commandline
For more fastboot Commands go - Here
---------------------------------------------------------------------------------------
Congrats! You now have Fastboot and ADB up and running!!!
----------------------------------------------------------------------------
Disclamer: I am not liable to any damage that happens to your phone. This is just a guide which you have chosen to follow, so please do not blame me for any damaged phones or bricks.
Nandroid Backup and Restore
Whats is a Nandroid Backup?
Like My Guide(s)? Donate
Nandroid Backup is a tool allowing all rooted g1 users to create a full system backup and restore which, when flashing and testing different roms can be very useful.
----------------------------------------------------------------------------
What You Will Need
A Rooted G1 phone, I suggest with the latest SPL (Guide above to install latest Radio and SPL)
Cyanogen's Pimped Out Recovery Image 1.4 - Download (IMG)
An SD Card with 100mb of free space
A Computer
SD Card reader or USB Cable
----------------------------------------------------------------------------
Installing the New Recovery Image
Download the recovery image from above, you will want the Download (IMG) download
Place the cm-recovery-1.4.img file in the root of your SD Card (Root = not in any folder)
Go back to your phone (Dont forget to unmount)
Open terminal and type in the following
Code:
su (wait for a screen to popup and press "allow")
flash_image recovery /sdcard/cm-recovery-1.4.img
If you have problems with a "no space on device" error, try using fastboot and erasing first:
Code:
fastboot erase recovery
fastboot flash recovery cm-recovery-1.4.img
----------------------------------------------------------------------------
Creating a Backup using Nandroid 2.1
Boot up your phone in recovery (Turn off, then turn on while holding Home button)
You will now see your new Cyanogen 1.3.1 + JF recovery screen (YAY!!! )
Scroll down to "nandroid v2.1 backup" and press on it to create your Backup
Let it work, it should take a minute or so
Once its done, your backup is complete and is saved on your sdcard in the "nandroid" folder
Recovering to Your Nandroid Backup
Option 1 (Without a Computer)
Note: This recovery will only recover your latest nandroid backup (the one with the newest timestamp)
Make sure u made a backup and its in the nandroid folder on your sdcard
Boot up your phone in recovery (Turn off, then turn on while holding Home button)
Scroll down to "restore latest backup" and press on it
Let it work
Once its done reboot your phone and you backup will now be restored!
Option 2 (With a computer)
Note: With this option, you can use any nandroid backup that you have made, not just the latest one
1) First go in to your tools folder where you put your SDK 1.5r2 (C:\android-sdk-windows-1.5_r2\tools as reference)
2) Take the files adb.exe fastboot.exe and AdbWinApi.dll (found here - http://sharebee.com/16a06ebb) and place them in C:\WINDOWS\system32
3) Download the Nandroid Backup and Restore GUI made by Markazeh - Here
Extract the folder to your desktop or where ever you can easily find it (I put mine in the SDK folder for easy access)
4) You will need 4 files: Boot.img, System.img , Data.img, and Recovery.img
Place those 4 files in the same folder as the Nandroid Recovery GUI folder you just extracted in step 3
5) Boot your phone into fastboot mode (Turn off the G1 and turn on while holding the BACK button. If you have an older SPL then hold the CAMERA button and press POWER)
6) Once in fastboot (you should see a white screen with three androids on skateboards) plug your phone to your computer via USB. You might have to press the BACK key to turn it into FASTBOOT mode, or follow the on screen prompts.
NOTE: If you dont have the drivers installed please look one post above to setup fastboot
7) Open NANDROID_Recovery_GUI.exe, everything on the left hand side should be "found!"
8) Choose an option from the right to Restore All, Restore all except Recovery, or Restore Data Only. Let the program do its thing.
Once its done you can reboot and all your info from your backup should be restored!
----------------------------------------------------------------------------
Congrats! You now Backed up your phone and will/have restored it!
----------------------------------------------------------------------------
Disclamer: I am not liable to any damage that happens to your phone. This is just a guide which you have chosen to follow, so please do not blame me for any damaged phones or bricks.
Credit:
Haykuro
Cyanogen
JacHero
NeoBlade
Markazeh
makethetick
XDA Community for your support and help
If i have forgot anyone, i am sorry, please tell me and i will add you
Excellent Guide bro. Although I have no need for it, still A++. Might want to include how to do a nandroid restore just a suggestion!
[EDIT]: I think this guide is worthy of a sticky! What do you guys think? ^^
You are the man!!!
Short simple and to the point!!!
0nly if all the guides were like this...
Thanks man!
not sure if this is the right spot or not but ever since I flashed from cy36 to 361 I keep losing my adb connection I have to g1s and while I'm working on one the other one isn't even connected to the computer so I just flashed the hero theme on one and plugged it in usb and tried to do the clock switcher didn't work so I go do a cmd and do an adb devices and there's nothing listed then I do an adb shell and it says error device not found but the computer sees it and the adb driver is loaded along with the mass storage driver and haven't had any problems until now.
PlatinumMOTO said:
not sure if this is the right spot or not but ever since I flashed from cy36 to 361 I keep losing my adb connection I have to g1s and while I'm working on one the other one isn't even connected to the computer so I just flashed the hero theme on one and plugged it in usb and tried to do the clock switcher didn't work so I go do a cmd and do an adb devices and there's nothing listed then I do an adb shell and it says error device not found but the computer sees it and the adb driver is loaded along with the mass storage driver and haven't had any problems until now.
Click to expand...
Click to collapse
You might want to try reinstalling the drivers and the USB Storage devices. That fixed it for me
Did you follow the "Preparing your phone for ADB" steps? and do ^ that suggestion first. lol
Mikey1022 said:
Did you follow the "Preparing your phone for ADB" steps? and do ^ that suggestion first. lol
Click to expand...
Click to collapse
yes I did I've had adb since sdk 1.0 and never had a problem like I said I actually have 1.0 and 1.5 on my computer so that when I root or re root other g1s I do adb but I noticed adb only works on it's version if I had a 1.5 g1 then the 1.0 won't work and same with the other way but that's not the problem I think I found it it's the clock switcher with 361 of Cyan because now I deleted it and restarted and it works just fine and I just tried to do the clock switcher and now it doesn't recognize either g1 again.
push apk via abd while in recovery mode?
Is it possible to use ADB to push apk files to the phone when the phone is in recovery mode? I tried and it didn't work (the files I was trying to replace weren't overwritten), and I'm wondering if it's because I did something wrong, or if it just doesn't work. I have adb working fine otherwise, have used it a bunch, including to push files while the phone was booted normally.
Specifically, I want to push the calendar.apk and calendarprovider.apk (I like the 1x4 calendar widget better than the 2x2). I want to do this in recovery mode so that the calendar isn't running when the file gets overwritten. I keep having calendar problems after pushing the 1x4 widget, and I think the problems are due to the calendar being active when the file gets replaced.
ADB Commands...
First I would like to say I think the guide is great. Though I don't have a lot of use for it, but I have some suggestions to make:
1. List some ADB commands and what they do, specifically how to use them, and what you would use them for. This forum has taught me so much about my phone and linux, but sometimes it was a slow learning process. Working the ADB push/pull feature was confusing when I first started using it.
2. Nandroid Back-ups. I still don't think I am using it correctly. I know there is a guide, but it still seems confusing. Maybe dumb it down a little.
3. Maybe more information on fastboot. I'm not sure exactly what it is or does, seems like just another version of recovery terminal, which from everything I have learned so far, if you can't get to your recovery terminal, you probably won't be able to get to your fastboot either.
ccunningham83 said:
Maybe more information on fastboot. I'm not sure exactly what it is or does, seems like just another version of recovery terminal, which from everything I have learned so far, if you can't get to your recovery terminal, you probably won't be able to get to your fastboot either.
Click to expand...
Click to collapse
Actually, you can access fastboot from the bootloader, so it's available even if the recovery console isn't.
heldc said:
Is it possible to use ADB to push apk files to the phone when the phone is in recovery mode? I tried and it didn't work (the files I was trying to replace weren't overwritten), and I'm wondering if it's because I did something wrong, or if it just doesn't work. I have adb working fine otherwise, have used it a bunch, including to push files while the phone was booted normally.
Specifically, I want to push the calendar.apk and calendarprovider.apk (I like the 1x4 calendar widget better than the 2x2). I want to do this in recovery mode so that the calendar isn't running when the file gets overwritten. I keep having calendar problems after pushing the 1x4 widget, and I think the problems are due to the calendar being active when the file gets replaced.
Click to expand...
Click to collapse
In recovery, nothing is mounted. So in order to push and overwrite the calender and calenderproviders, you have to do this in recovery/adb shell
mount /system/app
After that, You should be able to push the files + overwrite them =]. QQ why do you want to do this inrecovery and not when the phone is turned on and fully functional?o_o
but how many times is bootloader available when recovery console isn't? I understand they are different, but from everything I have seen, if you can get one, you can get the other and if you can't get one, you cant get the other either.
ccunningham83 said:
First I would like to say I think the guide is great. Though I don't have a lot of use for it, but I have some suggestions to make:
1. List some ADB commands and what they do, specifically how to use them, and what you would use them for. This forum has taught me so much about my phone and linux, but sometimes it was a slow learning process. Working the ADB push/pull feature was confusing when I first started using it.
2. Nandroid Back-ups. I still don't think I am using it correctly. I know there is a guide, but it still seems confusing. Maybe dumb it down a little.
3. Maybe more information on fastboot. I'm not sure exactly what it is or does, seems like just another version of recovery terminal, which from everything I have learned so far, if you can't get to your recovery terminal, you probably won't be able to get to your fastboot either.
Click to expand...
Click to collapse
If you type "adb" in terminal you get a whole list of the options and what they do Also what part of nandroid backup don't you understand? Its just booting into recovery and alt+b. I assume you mean nandroid restores right? Drop me a PM maybe I can help you
ccunningham83 said:
but how many times is bootloader available when recovery console isn't? I understand they are different, but from everything I have seen, if you can get one, you can get the other and if you can't get one, you cant get the other either.
Click to expand...
Click to collapse
Its because the boot loader is dependent on the SPL and if you flash the "Danger" SPL which is basically the only one that causes problems, then you have a chance of bricking your phone. In that case, brick = no bootloader no recovery
ccunningham83 said:
but how many times is bootloader available when recovery console isn't? I understand they are different, but from everything I have seen, if you can get one, you can get the other and if you can't get one, you cant get the other either.
Click to expand...
Click to collapse
Well, actually, I recently had just this happen. My fiance got a g1, and somehow in flashing it for him, it ended up without a working recovery console. It wouldn't flash the recovery image from within the OS, so I had to use fastboot to flash the recovery image. So, it's quite possible to have a bootloader and no recovery console.
alritewhadeva said:
In recovery, nothing is mounted. So in order to push and overwrite the calender and calenderproviders, you have to do this in recovery/adb shell
mount /system/app
After that, You should be able to push the files + overwrite them =]. QQ why do you want to do this inrecovery and not when the phone is turned on and fully functional?o_o
Click to expand...
Click to collapse
Ah ha, that's likely the problem, thanks!
Like I said, I want to overwrite a system app, the calendar. Every time I've done this with the phone "fully functional", the app ends up constantly force closing. I suspect this might be due to corruption from overwriting the app while it's running. I'm hoping that if I replace the app when the OS isn't on, the replacement app will work properly.
No problem You could also try replacing the calender app in a ROM and resigin it and then flash it. Have you tried rebooting after replacing the Calender app when the phone is I quote from myself " fully functional "?
This Guide assumes you have the SDK setup and know how to use adb
Download the OTA zip
Rename it to JWR66V.zip
Move JWR66V.zip to your platform-tools folder, I have the android studio installed so I put it in /home/MYUSERNAME/android-studio/sdk/platform-tools/JWR66V.zip
Plug in your Nexus 7 with USB debugging enabled (in Developer options)
open up your terminal and type
Code:
adb devices
You should get something like
Code:
015d3248d95bea10 device
Now type
Code:
adb reboot bootloader
and you're Nexus 7 will reboot into the bootloader, at which point you must use the volume up and down buttons until the screen displays "Reboot Recovery" in the top right. Now press the power button to reboot into recovery: You will see the Google logo as normal, then a green Android with a red warning sign with an exclamation mark inside.
Press the volume up button and the power button at the same time ONCE (do not hold them down) and this screen will disappear and you will be in recovery. Use the volume buttons to move between options and highlight “apply update from ADB.” and press the power button to choose.
Back to your terminal, cd into your platform-tools directory where your JWR66V.zip is located, e.g. for me:
Code:
cd ~/android-studio/sdk/platform-tools/
Now type
Code:
adb sideload JWR66V.zip
Your terminal should tell you it's sending the update package, and once that's finished your Nexus 7 should begin applying it.
TROUBLESHOOTING
This did not work for me. If you get the message
Code:
error: insufficient permissions for device
Then type:
Code:
sudo ./adb kill-server
then
Code:
sudo ./adb devices
and you should get a message such a
Code:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
015d3248d95bea10 sideload
Now type
Code:
sudo ./adb sideload JWR66V.zip
and all should go well
FINISHING OFF
After the update has finished applying, you have 2 options: reboot, or wipe cache and reboot. I personally chose to wipe cache to be on the safe side, and your Nexus 7 will reboot automatically after this anyway. You can reboot as normal if you want, however. Simply choose which option you want with the volume buttons and press power to apply.
I hope this has helped the impatient amongst us
Contents / Thread overview
Introduction
What is Fastboot?
What is adb?
How to install adb and fastboot
How to test adb and fastboot work
OK Gimme some useful fastboot commands please!
OK Gimme some useful adb commands please!
A little more about using Windows command prompt
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
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
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.
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.
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.
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.
Boot your phone into android
Connect it to your computer via USB
Open cmd (start > type "cmd" on Windows) or Terminal (Mac/ Linux
Type in the windows "adb devices" and press enter
Here is what we don't want to see:
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:
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:
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.
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....
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
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.
As you can see, the recovery.img is located in C:\users\rootSU\Desktop
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:
So lets try and fastboot flash recovery recovery.img...
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
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
Success! As you can see, we have told the command that the location for the file is Desktop\recovery.img
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"
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:
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.
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
This should absolutely be a sticky!!
Sent from my EVO using XDA Premium 4 mobile app
Evolution_Freak said:
This should absolutely be a sticky!!
Sent from my EVO using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Thanks. I created it specifically to put in the general sticky in my signature. Section 1a and 4
Great work @rootSU definitely should be sticky!
psycho693 said:
Great work @rootSU definitely should be sticky!
Click to expand...
Click to collapse
Thanks. Its in there. All in the main sticky thread
Sent from my Nexus 5 using Tapatalk
rootSU said:
Thanks. Its in there. All in the main sticky thread
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
It helps a lot because I have been looking for a good guide to pull system files while the phone is running
psycho693 said:
It helps a lot because I have been looking for a good guide to pull system files while the phone is running
Click to expand...
Click to collapse
Cool
The main thing for me was we had a diagnosis thread and we had a full guide for rooting or returning to stock but nothing to answer the how to set up or how to adb push basic questions... I've seen several threads today alone
Sent from my Nexus 5 using Tapatalk
Very cool, didn't actually know the push/pull commands or that driver you reference
wonderful(really wonderful)!
but i cant find the start button on this toolkit.. :silly:
simms22 said:
wonderful(really wonderful)!
but i cant find the start button on this toolkit.. :silly:
Click to expand...
Click to collapse
LMAO! rootSU, this is freakin awesome. Every thread that I find complaining about issues with toolkits will be redirected here. If this isn't stickied it should be a crime.
Sent from my Nexus 5 using xda premium
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
Thanks for listing my Nexus Tools
corbin052198 said:
Thanks for listing my Nexus Tools
Click to expand...
Click to collapse
Thanks for making them
Sent from my Nexus 5 using Tapatalk
simms22 said:
wonderful(really wonderful)!
but i cant find the start button on this toolkit.. :silly:
Click to expand...
Click to collapse
How do I flash the toolkit? I think its bricked :silly:
Good thread.
Amazingly detailed thread. There's no way to mess up reading this thread, the noobs will definitely learn if they can do the reading first that is.
I will laugh when a noob asks, "fastboot? It takes about a minute for me to boot!"
Sent from my Nexus 5 using XDA Premium 4 mobile app
I'm not sure what this all is, but awesome guide!!!!
? I'll be frequently linking this too.
Good job my friend, i am sure it's really helpful for a lot of people
Tapatalk Team SlimRoms
Added the below section about using command prompt. Hopefully a little more detail should help.
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.
As you can see, the recovery.img is located in C:\users\rootSU\Desktop
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:
So lets try and fastboot flash recovery recovery.img...
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
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
Success! As you can see, we have told the command that the location for the file is Desktop\recovery.img
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 <directory>" or in this case "cd Desktop"
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:
Click to expand...
Click to collapse
Added a bit more about using directory paths with spaces.
Sent from my Nexus 5 using Tapatalk
After a week with my new nexus, it's time for a litlle fun... But first must say thank you for this explanation.
Sent from my Nexus 5 using Tapatalk 2
somehow I managed to install the OTA MM update that I was holding off until I could unlock, root, blah, blah, blah.
I'm now on 20i.
And it responds to adb (v1.032) and fastboot commands from Terminal on my OSX MacBook Air.
Has anyone "authorized" (aka - fastboot oem unlock) their 811 and flashed TWRP from a Mavs Mac ?
Or do I need to go to my Bootcamp partition to accomplish?
Seems like to should work from Mavs direct, but …….
Bootcamp not needed.
system settings (tap on Build number until it says you’re a developer.)/developer/check oem unlock & USB debug
USB connect to Mac. I use Android File Transfer. I found it less annoying and very fast.
But it will not work with the LG drivers installed. aka LGUnitedMobileMacDriver_v4.23.zip, or LGMobileMacDriver_v5.2.zip, or LGBridge_Mac.dmg.
in Terminal:
adb devices - should reveal the devices serial - LGH811xxxxxxxxx. If not, your Mac and adb/fastboot are not set up properly.
adb reboot bootloader
fastboot devices - should reveal serial again. xxxxxxxx
fastboot oem unlock - this will WIPE the G4s internal SD that comes with the phone.
fastboot getvar unlocked - to confirm unlock
fastboot reboot - and set-up as a new device.
If you're on MM, and you set it up previously, restore should happen automatically upon reboot, after you enter your google or ID, etc.
If it seems to be taking too long, restart.
Make sure you recheck that USB debug is checked in developer options.
and then to flash TWRP and SuperSu so as to root.
Terminal:
adb reboot bootloader
fastboot boot (drag and drop the {I shortened the name of the file after duping} twrp.img into the Terminal window)
This will boot you into a temporary TWRP recovery. (v2.8.7.2)
Install twrp.img (select zip or img button bottom right)
Then install SuperSu 2.6.7.zip.
REBOOT SYSTEM
check root -
Terminal:
adb shell. should get #. if not - su. should get #.
troubleshooting.
May have to re-enter developer mode
sys settings/about/software/more/tap build number 7 times fast.
unplug USB.
Toggle USB debugging in Developer. Should get prompt about RSA.
re-plug USB
adb kill-server
adb devices
If TWRP isn't recognizing your b.u., write a new back-up. This creates the path TWRP wants to see. Copy your old b.u. into the new folder:
TWRP/BACKUPS/LGH811#########/2016-10-23--15-58-36_MRA58K
RenameÂ*the old b.u. the same as the new b.u. and toss the new one.
Reboot Recovery and you now should now able to to restore from the old b.u.
I have mi a2 with android 10 stock rom. Never unlocked bootloader. Now, I want to flash it back to android 9. Could some one please tell me how to do it? Thank you
So, you are writer, not reader (hint: search works well in these forums), but here is a brief:
1. Save all your data to google cloud, to PC, etc. (there are numerous 3rd party tools, for example SMSBackupRestore, MyPhoneExplorer, etc., which enable partial backups of your data);
2. Get developers rights in phone (search here for instructions), and in "Developers options" check "OEM unlocking" and "USB debugging" to ON; "Automatic system updates" to OFF;
3. Download and unpack latest https://developer.android.com/studio/releases/platform-tools, get somewhat acquainted with Android ADB and fastboot commands;
4. Ensure that "Android Device" drivers are correctly installed:
- attach phone in "No data transfer", "File transfer" (MTP), stock recovery and fastboot (bootloader) modes (search here for instructions to go to fastboot and stock recovery modes), and ensure that DeviceManager shows "Android Device" drivers working in each mode;
- possible Capcha here: MiA2 is very selective in work with PC motherboard USB subsystem, usually needs to be connected to USB2.x port to operate via ADB/fastboot;
- open CMD shell with administrative rights in the dir platform-tools were unpacked to, attach phone in "File transfer" (MTP), stock recovery and fastboot (bootloader) modes and ensure that following commands return valid responses:
Code:
ADB devices - l
in first 2 modes, and
Code:
fastboot devices
in bootloader mode;
- Capcha here: phone will prompt to approve PC for USB debugging, you'll need to approve, checking "do not ask again" is reasonable;
5. switch phone to bootloader mode (by phone buttons or with 'ADB reboot bootloader' command) and unlock phone with 2 commands (rebooting phone each time):
Code:
fastboot flashing unlock
fastboot flashing unlock_critical
- in bootloader mode in CMD shell type "fastboot getvar all" and see is phone is really unlocked, what is current slot, etc.
6. Download Android 9.0 [V10.0.17.0.PDIMIXM] from https://forum.xda-developers.com/mi-a2/how-to/fastboot-xiaomi-mi-a2-fastboot-images-t3824849 (last V10.0.18.0 had bugs) and unpack it (note that ROM image is packed twice) to the dir platform-tools were unpacked to (or copy of this dir);
7. Open CMD shell with administrative rights in the prepared dir (if not done before), attach phone in fastboot (bootloader) mode and type in flash_all command thus starting "flash_all.bat" command file;
- executing this file will erase user data;
- read output of fashing process in CMD window to be aware of possible errors;
8. It is recommended to make factory reset after changing major Android versions, either from stock recovery (Capcha: seeing "No command" press Power and click Vol+ to see list of commands), or from CMD shell with "fastboot -w" command.
9. Make initial phone setup again.
Note: you may try to skip steps 8 (wiping) and 9, and in step 7 use "flash_all_except_data.bat" command in attempt to preserve /data partition in phone, but I am pretty much sure that factory reset would be needed if not immediately than in a day or two.