As for the rest of this tutorial, it is for complete beginners - even to shell, or command prompt.
First off, you need to set the system path to include the folder adb is in.
BEFORE WE BEGIN - I'd like to make this note. If you are using the USB cable that came with your device, especially samsung - I'd advise not doing so. Order a Blackberry data cable, they are less then a few bucks (seriously, you can get them for $1 or 2), and they are MUCH better - when you get it, you will be able to see the difference in wire gauge. Trust me - if you don't get one, you will be having issues, like adb telling you no device. Also - on many computers, you need to plug directly into the motherboard via the rear USB ports. Frontside ports don't work as well, nor any USB hub for that matter. Direct connection is the best.
Open your start menu, find Computer (or My Computer for XP), right click and hit properties. For those that don't know, there is actually a keyboard shortcut for this - Win+Break (the pause button). If on Win7 (maybe vista... I never used it), you'll have to click "Advanced System Settings" on the left side. If on XP, just click the advanced tab. Now click the button at the bottom that says "Environment Variables..."
Under "System variables", look for "Path". Click it, then click edit. At the END of the path (DO NOT REMOVE ANYTHING THAT IS ALREADY HERE!!), add a semi-colon [noparse]([/noparse], and the path to your adb.exe. For example, mine last entry was the one for TortoiseSVN, so I added the path, and it looks like this:
<LOT OF OTHER PATHS>;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Android\android-sdk\platform-tools
Please verify YOUR adb path, don't just copy this one.
Now, your path is set. Test it by opening command prompt (Win+R, type cmd, hit enter), and simply typing adb. You should get the adb help message:
Android Debug Bridge version 1.0.26 -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 ocmmand 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 help - show this help message adb version - show version num DATAOPTS: (no option) - don't touch the data partition -w - wipe the data partition -d - flash the data partition 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 worry, I'm going to walk through this with you.
The first few commands, you won't be using anytime soon. These are for when using multiple android devices at the same time on one computer.
adb devices - lists all connected devices - However, is useful for getting a serial number for your device.
adb connect - get WirelessADB - it can be your best friend. Once you get it, you can enable it, then type adb connect <ip address of phone>:<port> and wirelessly connect to your device.
adb push <local> <remote>:
Example: adb push c:\test.zip /sdcard/test.zip
Good for pushing files to your device. Can also be used to push entire directories
Example: adb pull /data/app c:\myAndroid\myApps
Used for pulling files from the device. The example given here will pull all the apks you have installed and put them in C:\myAndroid\myApps. Remember, with push or pull, the target directory needs to exist.
your best friend. If you are developing.... anything, you'll use logcat often. I generally have 2 command prompt windows open - one for logcat, the other for shell. Logcat prints out the log from the device in real time.adb install:
Used to install apk files onto your phone. Example: adb install c:\myApps\crazywonk.apkadb uninstall:
used to uninstall applications - do not use the apk file name, you need to use the package name:
abd uninstall com.vendor.android
adb remount - remounts the file system as read-write / read-only (toggles)
adb reboot - reboots phone
adb reboot recovery - reboots phone into the KERNEL recovery
These are pretty much the main adb commands you will need to start off with. Now Let's take a look at adb shell - Go ahead and run adb shell. You are now in the root directory of your device - NOT your sdcard. So be careful what you do unless you truly know what you are doing. Go ahead and send and ls command (same as a dir command in command prompt), and get a list of your directories. cd to sdcard, and you'll be in your sdcard, and can move files around here.
At this point however, if you are reading this guide on ADB basic commands, then you most likely shouldn't mess around too much in shell..... yet. Get used to android first, and look for a future tutorial on shell commands.
Edited by Alexander, 15 July 2011 - 04:37 PM.
Disabled erroneous smilies in (;)