Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,810,588 Members 45,503 Now Online
XDA Developers Android and Mobile Development Forum

[Guide]Setting up ADB and Fastboot

Tip us?
 
mOh19973
Old
(Last edited by mOh19973; 9th April 2012 at 07:52 PM.)
#1  
mOh19973's Avatar
Member - OP
Thanks Meter 47
Posts: 68
Join Date: Sep 2011
Location: Beirut
Post [Guide]Setting up ADB and Fastboot

Definition:

ADB is the android debugging bridge that allows you to control your phone from your PC and is a bridge allowing you transfer stuff from it

Fastboot is usually used in bootloader and used a lot in unlocking your bootloader and commands in it

Setting up ADB:

1.Download the ZIP file from the attachments and extract it in C:\SDK\platform-tools (You will need to create these folders)
2. Go to command prompt by typing this word in menu search
3.Start writing
Code:
cd C:\SDK\platform-tools
adb.exe
You will see
Code:
Android Debug Bridge version 1.0.29

 -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. Overrides ANDROID_SERI
AL
                                 environment variable.
 -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
 connect <host>[:<port>]       - connect to a device via TCP/IP
                                 Port 5555 is used by default if no port number
is specified.
 disconnect [<host>[:<port>]]  - disconnect from a TCP/IP device.
                                 Port 5555 is used by default if no port number
is specified.
                                 Using this command with no additional arguments

                                 will disconnect from all connected TCP/IP devic
es.

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
                                 (-l means list but don't copy)
                                 (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 forward <local> <remote> - forward socket connections
                                 forward specs are one of:
                                   tcp:<port>
                                   localabstract:<unix domain socket name>
                                   localreserved:<unix domain socket name>
                                   localfilesystem:<unix domain socket name>
                                   dev:<character device name>
                                   jdwp:<process pid> (remote only)
  adb jdwp                     - list PIDs of processes hosting a JDWP transport

  adb install [-l] [-r] [-s] <file> - push this package file to the device and i
nstall it
                                 ('-l' means forward-lock the app)
                                 ('-r' means reinstall the app, keeping its data
)
                                 ('-s' means install on SD card instead of inter
nal storage)
  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 backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|-nosy
stem] [<packages...>]
                               - write an archive of the device's data to <file>
.
                                 If no -f option is supplied then the data is wr
itten
                                 to "backup.ab" in the current directory.
                                 (-apk|-noapk enable/disable backup of the .apks
 themselves
                                    in the archive; the default is noapk.)
                                 (-shared|-noshared enable/disable backup of the
 device's
                                    shared storage / SD card contents; the defau
lt is noshared.)
                                 (-all means to back up all installed applicatio
ns)
                                 (-system|-nosystem toggles whether -all automat
ically includes
                                    system applications; the default is to inclu
de system apps)
                                 (<packages...> is the list of applications to b
e backed up.  If
                                    the -all or -shared flags are passed, then t
he package
                                    list is optional.  Applications explicitly g
iven on the
                                    command line will be included even if -nosys
tem would
                                    ordinarily cause them to be omitted.)

  adb restore <file>           - restore device contents from the <file> backup
archive

  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 reboot [bootloader|recovery] - reboots the device, optionally into the boo
tloader or recovery program
  adb reboot-bootloader        - reboots the device into the bootloader
  adb root                     - restarts the adbd daemon with root permissions
  adb usb                      - restarts the adbd daemon listening on USB
  adb tcpip <port>             - restarts the adbd daemon listening on TCP on th
e specified port
networking:
  adb ppp <tty> [parameters]   - Run PPP over USB.
 Note: you should not automatically start a PPP 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.

environmental variables:
  ADB_TRACE                    - Print debug information. A comma separated list
 of the following values
                                 1 or all, adb, sockets, packets, rwx, usb, sync
, sysdeps, transport, jdwp
  ANDROID_SERIAL               - The serial number to connect to. -s takes prior
ity over this if given.
  ANDROID_LOG_TAGS             - When used with the logcat option, only these de
bug tags are printed.
Don't freak out everything will be explained

4.Connect device and make sure that USB Debugging is enabled from Settings:Applications:Development(on GB)
Settings:Developer Options(on ICS and HC)

5.Write
Code:
adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
Device name
6.There are common commands used on ADB:
Code:
adb reboot 
adb reboot recovery
adb reboot bootloader
adb push C:\<directory>\file /sdcard/
adb pull /sdcard/file C:\<directory>\
adb install C:\<directory>/file.apk
              or /sdcard/<directory>/file.apk
adb remount
Push and Pull means copy form directory to another

ADB Shell for in device commands
Code:
adb shell
#mv /sdcard/file /system/app
#cp /sdcard/file /system/app
#rm /sdcard/file 
#mkdir /sdcard/yourfoldernamehere
#ls /sdcard/<directory>
Setting up fastboot: Your phone must be on bootloader
Code:
cd C:\SDK\platform-tools
Commands List:
Code:
fastboot devices  lists which devices in fastboot mode are currently attached to your computer

fastboot boot <filename>  boots a rom stored on your pc specified by the filename

fastboot flash <partition> <filename>  flashes a rom stored on your pc, partition can be one of {boot, recovery, system, userdata}
Example: fastboot flash recovery C:\<directory>\recovery.img
PS: When i wrote <directory> it means like C:\Users\Desktop\Desktop\file
Or you can put the file in the the platform-tools folder you created so
write Ex:
Code:
adb push file.apk /sdcard/
Attached Files
File Type: zip platform-tools.zip - [Click for QR Code] (440.1 KB, 43537 views)
  • Current Device: LG Nexus 5
  • Android Version: 4.4.2
  • Baseband Version: M8974A-1.0.25.0.23
  • Kernel Vesion: 3.4.0-gadb2201
  • Build Number: KOT49H
  • Previous Devices
    HTC Incredible S
    HTC Desire S


Don't Forget to press "Thanks" if this thread is useful

Press Here for possibly Useful threads for you
The Following 32 Users Say Thank You to mOh19973 For This Useful Post: [ Click to Expand ]
 
Ngoeun
Old
#2  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Apr 2012
Default Got stuck with htc logo after the LeeDroid flash on my HTC

Hi All,

Good morning. I am very new with Android, I did the flash rom using Leedroid 4.3.0 I can flash it ok, but it said I use s-off so I need to extract the boot.img from rom.zip and flash it.

I have no idea how to flash it. Can anyone guide me step by step.
I tried the ADB.exe with CMD but no luck, although it say (sending boot <3853 kb> ... okay, writing boot... OKAY, I still cannot get it to work, after reboot, I still got stuck with htc logo.
I am using HTC flyer, HBOOT 6.10.1002

Thank you in advance for your help
 
esideboi
Old
(Last edited by esideboi; 20th April 2012 at 10:14 AM.)
#3  
Senior Member
Thanks Meter 13
Posts: 114
Join Date: Oct 2011
Location: Bratislava
you need to flash it when you are in bootloader using fastboot command:

fastboot flash boot boot.img
The Following 2 Users Say Thank You to esideboi For This Useful Post: [ Click to Expand ]
 
mrsureshisha
Old
#4  
Member
Thanks Meter 7
Posts: 73
Join Date: Sep 2012
Location: Chennai
You are my first teacher......enjoyed it....Thanks a lot...
 
titasb
Old
#5  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Sep 2012
Default Incredible s stuck on loading

Hey All,
Here is my story -
Never felt the need of rooting my phone, until one of my relatives, done that for me. If I ever knew, that i will have so many problems, I would have never let him do that.
Moving on, I couldn't find a rom fitting myself, always had bugs, used too much of my battery, or so on. Got tired losing everything, everytime i had to change the rom, after finding a bug i couldn't stand. So, I came back to original rom 2.3.5. Thought i will just update and will have S-off phone with original software.
Somehow it didn't let me update, I stayed with that for few months, then one day i decided i can't stand the old soft, and started working on getting my phone back to s-on and original rom. Used Android flasher to flash this file engHBOOToverARX . The next step was to flash the original rom, via
Android flasher. But i couldn't find it on internet. Therefore i thought it's just gonna be easier and faster that i'll just go and scan for the update.
It found and finally was updating when I was happy i'll get back to normal phone. Unfortunately, It wouldn't load the software anymore, only the white screen with the HTC logo.

Bootloader still says
Revolutionary
Vivo PVT SHIP S-OFF RL
HBOOT - 6.13.1002
RADIO - 3822.10.08.28_M
eMMC - boot
Apr 1 2011, 18:34:39



I tried to follow the steps, on the cmd.
But it looks like it can not find the device.
My phone is connected to the computer via usb cable and on the bootloader menu.


PLEASE HELP ASAP.

I am using my old Nokia 6310i as the backup plan at the moment, and believe me it is not fun at all, uxcept the fact that I make everyone laugh
when I take it from my pocket

Titas
 
ben_pyett
Old
#6  
ben_pyett's Avatar
Recognized Contributor
Thanks Meter 1,902
Posts: 4,922
Join Date: Oct 2006
Location: London, Colchester, Wivenhoe
Where to start:

This is not a general help thread

This is not even in the Q&A forum

You have a VIVO which is an incredible s not SAGA (codename for desire s so you're in the wrong forum)

Sywepd form my DsereiS
Nexus 5 : hammerhead
Rom (Kernel): Mahdi-Rom 4.4.4 [v2.7 Test-14/09/2014 (ART)] (Franco [#r63]) root: [superSU v2.02] TWRP
Retired - Nexus 4 (standby phone), HTC Desire S, HTC Touch Diamond 2, HTC Dual Touch, HTC TyTN, Innumerable NOKIAs
 
ayanah
Old
#7  
Junior Member
Thanks Meter 0
Posts: 4
Join Date: Oct 2012
Arrow explanation

"Setting up fastboot: Your phone must be on bootloader "
1st... what do you mean by "Your phone must be on bootloader" & how to do ??

2nd... I accessed this thread from another one concerning nabi II tablet rooting .... but I can't figure out the DIRECT importance to know that ...in regard to rooting the nabi II
.... is it essential ??

3rd.. can u please write the prompt commands in full manner ... as sometimes u use "\" or "/" eg:
"adb install C:\<directory>/file.apk
or /sdcard/<directory>/file.apk "
that's a little bit difficult ..thanks
 
SimonTS
Old
#8  
SimonTS's Avatar
Senior Member
Thanks Meter 1,553
Posts: 3,999
Join Date: Oct 2011
Location: Bristol
Quote:
Originally Posted by ayanah View Post
"Setting up fastboot: Your phone must be on bootloader "
1st... what do you mean by "Your phone must be on bootloader" & how to do ??
If you don't know that then you need to do A LOT of reading before attempting to play around with your device

Quote:
Originally Posted by ayanah View Post
2nd... I accessed this thread from another one concerning nabi II tablet rooting .... but I can't figure out the DIRECT importance to know that ...in regard to rooting the nabi II
.... is it essential ??
I have no idea how you got here from the Nabi II forum - unless someone there felt that this was a decent guide to also use on the Nabi II

Quote:
Originally Posted by ayanah View Post
3rd.. can u please write the prompt commands in full manner ... as sometimes u use "\" or "/" eg:
"adb install C:\<directory>/file.apk
or /sdcard/<directory>/file.apk "
that's a little bit difficult ..thanks
The OP is NOT going to rewrite his guide just for you after 6 months. Also, the difference between using '\' and '/' depends on whether you are using Windows or Linux - if you can't work that out then I would also suggest that you leave your device alone before you destroy it.


Sent from the darkest corners of my mind
 
ayanah
Old
(Last edited by ayanah; 2nd November 2012 at 11:04 PM.) Reason: correct link
#9  
Junior Member
Thanks Meter 0
Posts: 4
Join Date: Oct 2012
Info 2 a reply

Quote:
Originally Posted by SimonTS View Post
If you don't know that then you need to do A LOT of reading before attempting to play around with your device


I have no idea how you got here from the Nabi II forum - unless someone there felt that this was a decent guide to also use on the Nabi II


The OP is NOT going to rewrite his guide just for you after 6 months. Also, the difference between using '\' and '/' depends on whether you are using Windows or Linux - if you can't work that out then I would also suggest that you leave your device alone before you destroy it.
by the way .. in less than 1 hrs I used his guide to install programs from my PC (& I had no previous knowledge even where to start command prompt) on my old galaxy i5700 (use it for trials) ... I installed the programs using "adb install ....." & every thing is OK ... & I had successfully rooted my galaxy s6102 using another thread (not the one click programs) also every thing is OK ... I'd like to tell you I know about (rooting) less than 2 days ago ... so I think this is a good start for me ..... SO .. it would be appreciated to anyone who could answer me in short just showing little pit details & the pitfalls to avoid ...

also I thought"\" is where I copy from &"/" where I copy to i.e. concerning the direction of the path ... but I wasn't sure so I needed to get that explained

thanks for help but let OP take the decision HIMSELF.

referral thread :http://forum.xda-developers.com/show....php?t=1905674
 
kcallis
Old
#10  
Member
Thanks Meter 3
Posts: 81
Join Date: Dec 2008
Location: Waterville, ME
I have been trying to do a factory reset of the Nabi 2, and since I can't seem to access the "Mommy Mode", I thought I could do it from the recovery menu. So far I have yet to find any factor reset option available. Is there such a beast or am I out of luck?

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Real-World Battery Saving Tips for Android – XDA Developer TV

You need Real-World Battery Saving Tips for your Android device. Our … more

Android L Will Have Data Encryption Turned On by Default

Android L, once it is eventually released, will featuredata encryption turned on by … more

Lock Apps and Functions Easily with Droid Protector

Access and security are some of the key issues facingmobile technology. Whether … more

ARChon Lets You Run Android Apps in Google Chrome Browser

Not too long ago, Google added the ability torun select Android applications on … more