Original URL: http://www.cnblogs.com/meil/archive/2012/05/24/2516055.html
ADB (Android Debug Bridge) is a tool in the Android SDK that uses ADB to directly manipulate the Android emulator or the real andriod device.
The main functions of ADB are:
1. Run the shell on an Android device (command line)
2. Port mapping for Management simulator or device
3. Upload/download files between the computer and the device
4. Install the local APK software on your computer to your Android emulator or device
1. Before using ADB, first look at whether you have installed the Android SDK Toolkit in eclipse (Android plugin download, installation Please refer here: Android program Development environment configuration), such as:
This USB drive is also needed to connect your Android device.
ADB is a client-server program where the client is the computer you use to operate, and the server side is the Android device.
2. If you have installed the Android SDK then you can find it in your SDK directory. \android-sdk-windows\platform-tools This directory, the ADB tool is placed here.
To copy the path to this directory, we need to set this path to path in the Windows system settings, and then we can use the ADB in the cmd window after the setup is complete.
3. We are now starting our andriod virtual machine and then entering the cmd window.
The emulator-5554 here is my virtual machine device.
4. Commonly used ADB commands
A) adb install <apk file path >
This command installs the specified APK file on the device
b) ADB uninstall < software name >
ADB uninstall-k < software name >
If you add the-K parameter, the software is uninstalled but the configuration and cache files are preserved.
c) ADB shell
This command will log on to the device's shell
adb Shell <command Command >
The following add <command command > will be run directly on the device command, equivalent to executing a remote command
d) ADB help
This command will display the Help information
c) ADB push < Local path > < remote path >
Send files from your computer to your device
ADB remount We also need to use the remount command to get the upload file permission before executing the push command, or it will appear
Read-only error message for file system
Examples such as
It is important to note that if you need to put files in a level two directory, you must use "/" instead of "\", because Android is a liunx system, and we use Windows. For example: Sdcard/aa This is good, otherwise you will be prompted not to find or insufficient authority.
d) ADB get-product
Get the ID of the device
e) ADB Get-serialno
Get the serial number of the device
f) ADB devices
Gets a list of instances of the currently running emulator/device and the status of each instance
g) ADB bugreport
View Bug reports
5. Commonly used adb shell commands
Entering the shell via the adb shell command
A) access to the database
Sqlite3
b) record the wireless communication log
Generally speaking, the wireless communication log is very many, at run time not necessary to record, but we can still through the command, set the record:
Logcat-b Radio
c) Delete the app
Android does not provide a command to uninstall the app and needs to manually delete it:
Cd/data/app
RM app name. apk
d) View the catalogue
Ls
e) Print or set the current system time
Date
f) View memory information
Cat/proc/meminfo
g) View CPU information
Cat/proc/cpuinfo
6. Remove the software that comes with the Android system ROM
A. Determine the root of the phone, get root permission to delete the system files AH.
B. Download the Android_db.rar and unzip it to%windir/%system32.
C. Connect the data cable to the phone, open cmd on the computer, and enter the command
ADB remount
ADB shell
Su
Once the execution is complete, you will see:
* Daemon not running. Starting it now *
* Daemon started successfully *
D. Then the Linux command-line mode, enter
CD System/app
You will find no change, then enter the LS return.
This time the list shows all the files in the System/app, which is the ROM integration of some software.
E. Start deleting it! Like deleting YouTube, his file name is Youtube.odex and youtube.apk.
We want to delete these 2 files and typed the following command:
RM youtube.*
Restart, YouTube has been deleted, pay attention to the students do not delete you do not know what is the thing.
7. sqlite3 adb command
Two ways to access the database
The first type: Sqlite3 database name. xx
The second type: adb shell
Sqlite3
. databases list database file names
. Tables? PATTERN? List? PATTERN? Matching table name
The. import file TABLE imports the data in the file
. Dump? TABLE? Generate SQL scripts that form database tables
. output FILENAME to import the outputs into the specified file
. output stdout Print to screen
. Mode mode? TABLE? Set the data output mode (CSV,HTML,TCL ...
. Nullvalue string replaces the output null string with the specified string
. read FILENAME executes the SQL statement in the specified file
. Schema? TABLE? Print the SQL statement that created the database table
. separator string replaces the field delimiter with the specified string
. Show print settings for all SQLite environment variables
. Quit Quit Command line interface
"Go" Android Development debugging tool for ADB use