Environment configuration for Android development and debugging tool ADB using Android Program Development

Source: Internet
Author: User

ADB (Android debug Bridge) is a tool in the android SDK. You can use ADB to directly manage Android simulators or real Android devices.
ADB provides the following functions:

1. Run shell (command line) on Android devices)
2. Manage port ing of simulators or devices
3. Upload/download files between computers and devices
4. Install the local APK software on the computer to the android simulator or device.

 

1. Before using ADB, first check whether the android SDK toolkit has been installed in your eclipse. (For the download and installation of the android plug-in, see here: Environment configuration for Android program development.) For example:

 

This USB driver is also required to connect to your Android device.

 

ADB is a client-serverProgramThe client is the computer you use to operate, and the server is an Android device.

2. If you have installed the android SDK, you can find the directory .. \ Android-SDK-Windows \ platform-tools in your SDK directory, and the ADB tool will be placed here.

 

Copy the path of this directory. We need to set this path in the Windows system settings to the path. After the setting is complete, we can use ADB in the CMD window.

 

3. Now we start our andriod Vm and enter the CMD window.

Here emulator-5554 is my virtual machine device

 

4. Common 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 the-k parameter is added, the software is uninstalled but the configuration and cache files are retained.

 

C) ADB Shell

This command will log on to the device's shell
ADB shell <command>

The <command> command is used to directly run the device command, which is equivalent to executing the remote command.

 

D) ADB help

This command displays help information

 

C) ADB push <local path> <remote path>
Send files from computer to Device

ADB remountBefore executing the push command, we also need to use the remount command to obtain the permission to upload files. Otherwise

Read-Only File SystemError Message

Example:

Note that if you want to put files in a second-level directory, you must use "/" instead of "\" because Android is a system in liunx, we use Windows. For example: sdcard/AA. Otherwise, the system will prompt that the SDK cannot be found or the permission is insufficient.

 

D) ADB get-Product
Obtain the device ID.

 

E) ADB get-serialno
Obtains the serial number of a device.

F) ADB Devices
Obtains the list of running Simulators/devices and the status of each instance.

G) ADB bugreport
View bug reports

5. Common ADB shell commands

Run the ADB shell command to access the shell

A) access the database
Sqlite3

B) Record wireless communication logs
In general, there are a lot of wireless communication logs and there is no need to record them during operation, but we can still set the record through the command:
Logcat-B radio

C) delete an application
Android does not provide a command to uninstall an application. You need to manually delete it:
CD/data/APP
Rm application name.apk

D) view the Directory
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. Delete the built-in Android Rom software.

A. confirm that the mobile phone is root. You have obtained the root permission to delete the system file.
B .download android_db.rar and decompress it to % WINDIR/% system32.
C. Connect the data cable to your mobile phone, open cmd on your computer, and enter the command
ADB remount
ADB Shell
Su
After the execution is complete, you will see:
* Daemon not running. Starting it now *
* Daemon started successfully *
D. in Linux Command Line Mode, enter
CD system/APP
You will find that there is no change, and then enter ls to press Enter.
At this time, the list shows all the files in the system/APP, that is, some rom integrated software.
E. Start deleting! For example, if you delete youtube, the file names are youtube.odexand youtube.apk.
To delete these two files, run the following command:
Rm YouTube .*
After restarting, YouTube has been deleted. Please do not delete anything you don't know.

 

7. sqlite3 ADB command

Two ways to access the database

First: sqlite3 database name. xx

Type 2: ADB Shell

Sqlite3

. Databases: List database file names
. Tables? Pattern? List? Pattern? Matched table name
. Import file table:
. Dump? Table? Generate an SQL script to form a database table
. Output Filename: import the output to the specified file.
. Output stdout print the output to the 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: Execute the SQL statement in the specified file
. Schema? Table? Print the SQL statement used to create a database table
. Separator string replaces the field separator with the specified string
. Show print the settings of all SQLite Environment Variables
. Quit exit command line interface

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.