Basic commands for newcomers to ADB
**If a line of code includes <xxx> in the first line, then a second line in RED, the second line is an example to help you better understand the format.
ADB stands for "Android Debug Bridge". It comes with the android 2.0 sdk and can be run from the windows command prompt or a mac/linux terminal. For instructions on setting up ADB, please see this thread: Set up ADB. In order to run ADB from your machine, you will need ensure the following in your Android "Settings" is set:
Settings -> Application Settings -> Development -> Then check the "USB Debugging" box.
To open a command window/terminal, in Windows go to Start > Run and type "cmd" (no quotes). Prior to using any of these commands, you will need to change the directory to the ADB folder on your machine. If using the default install location for the
Windows install, this would be C:\Android-SDK-windows and either the /platform-tools or /tools sub-directory, depending which one you copied all the files in. In this example I used the tools sub-directory.
** - The "cd" part of the command tells the system to "change directory" to path that follows.Code:cd C:\android-sdk-windows\tools
Command/Terminal Window Tips:
1) Pressing the "Tab" key will get the previous command entered.
2) You can also use the right arrow key to repeat the previous command, character by character, which can be a time saver if the following lines all start off the same.
To see /check devices connected to your system (hit return/enter to run command):
In response, adb prints this status information for each instance:Code:adb devices
Serial number — A string created by adb to uniquely identify an emulator/device instance by its console port number. The format of the serial number is
<type>-<consolePort>.
State — The connection state of the instance. Two states are supported:
offline — the instance is not connected to adb or is not responding.
device — the instance is now connected to the adb server. Note that this state does not imply that the Android system is fully booted and operational, since the instance connects to adb while the system is still booting. However, after boot-up, this is the normal operational state of an emulator/device instance
If there is no emulator/device running, adb returns "no device".
REMEMBER!!! You must hit return/enter after each command (or line) to run!
**If a line of code includes <xxx> in the first line, then a second line in RED, the second line is an example to help you better understand the format.
Pull/Push/Install Apps & Files:
To install an app:
To re-install an app, keeping it's data:Code:adb install <path_to_apk> adb install myapp.apk
To push apps from computer to phoneCode:adb install -r <path to apk> adb install -r myapp.apk
To pull apps from phone to computerCode:adb push <path to file on phone> <path to location on device> adb push test.txt /sdcard/test.txt
To clarify the path: In the examples above, the files were placed into the android-sdk/tools folder where ADB defaults to push them, or pull them. So test.txt just means the default path is: C:/android-sdk/tools/test.txtCode:adb pull <path to file on device> <file name for computer> adb pull /sdcard/test.txt test.txt
Reboot Commands:
Reboot your device:
Reboot device into Recovery mode:Code:adb reboot
Reboots the device into bootloader mode:Code:adb reboot recovery
Reboots the device into Fastboot mode:Code:adb reboot bootloader
Code:adb reboot fastboot
View Information:
Print a list of supported adb commands:
Print the ADB version number:Code:adb help
Code:adb version
Commands helpful in troubleshooting:
Compile a bug report:
Logcat - starts dumping debugging information from your device to the console – useful for debugging (may have to press control+c to exit):Code:adb bugreport
To output the logcat file to the folder you are running ADB from:Code:adb logcat
Code:adb logcat > logcat.txt
Miscellaneous Commands:
Remount remounts the /system partition as writable (or readonly if it is already writeable):
Code:adb remount
Shell Commands:
Shell lets you run an interactive shell (command prompt) on the Android device:
Look at the tasks running on your device:Code:adb shell
Check Memory Usage:Code:adb shell top
To fix permissions on your device:Code:adb shell free
Fastboot Commands:Code:adb shell fix_permissions
List devices currently attached to computers:
Unlocks a locked bootloader (must be rebooted into bootloader):Code:fastboot devices
To flash a Recovery image file:Code:fastboot oem unlock
Reboot device while in fastboot:Code:fastboot flash recovery recovery.img
**Boots a ROM stored on your computer specified by the filename**Code:fastboot reboot
**Flashes a ROM stored on your computer, partition can be one of {boot, recovery, system, userdata}**Code:fastboot boot <filename>
** - WARNING: I have not confirmed these last 2 commands work on the Xoom, but included them in case someone ends up here looking for them. Only use them if you know exactly what you are doing as I cannot confirm what it will do.Code:fastboot flash <partition> <filename>
More to be added as the thread expands.

If this is your first visit, be sure to
check out the 

6Likes
LinkBack URL
About LinkBacks






Reply With Quote








