Turn: ADB operations Command details and Daquan

Source: Internet
Author: User

When it comes to the ADB everyone should be not unfamiliar, that is, Android debug Bridge,android Debug Bridge, as the Android development of us, skilled use of the ADB command will greatly enhance our development efficiency, the ADB command a lot, today to summarize the development of some of my commonly used ADB command.

View version

ADB installation Here is not much to say, enter the following command to prove your environment OK, or you can search the Internet to solve.

$ adb version

Android Debug Bridge Version 1.0.36
Revision 8f855a3d9b35-android

View Connected Devices

Enter the following command to query the connected device and emulator:

$ ADB devices

List of devices attached
02AE0C1021089DAF Device

Install an APK and execute the following command:

ADB install <apkfile>

Example: adb install demo.apk
If it is not the current directory, follow the path name:

ADB install/users/storm/temp/demo.apk
Keep the data and cache files and reinstall the APK:

ADB install-r demo.apk
Install apk to SD card:

ADB install-s demo.apk
Unloading

Direct uninstall:

ADB uninstall <package>

such as: adb uninstall Com.stormzhang.demo
Uninstall the app but keep the data and cache files:

ADB uninstall-k Com.stormzhang.demo

Start/Stop Server

In general, the following two commands are basically not used, because as long as the device is connected correctly, the ADB server will start automatically, but you also need to know these two commands:

Start adb server:

ADB start-server

To stop ADB server:

ADB kill-server

List the package names of all apps installed on your phone:

ADB shell PM List Packages

List all package names for the system app:

ADB shell PM List packages-s

List third-party app package names in addition to system apps:

ADB shell PM List packages-3

Use grep to filter:

ADB shell pm List Packages | grep QQ

Clear app Data and cache

Sometimes we need to clear the data and cache, then we need to use the following command:

ADB shell pm Clear <packagename>

Example: adb shell pm Clear Com.stormzhang.demo

Launch the App

If we want to launch the app via ADB
ADB shell am start-n com.stormzhang.demo/.ui. Splashactivity

Force Stop App

There are times when the app is stuck and requires a forced stop, execute the following command:

ADB shell am force-stop <packagename>

such as: adb shell am force-stop cn.androidstar.demo

View Logs

ADB logcat

Restart

ADB reboot

Get serial number

$ADB Get-serialno

02ae0c1021089daf

Get MAC Address

$ADB Shell Cat/sys/class/net/wlan0/address

Bc:f5:ac:f9:f7:c8

View Device model

$ADB Shell Getprop Ro.product.model

Nexus 5

View Android System version

$ADB Shell Getprop ro.build.version.release

7.0.1

Viewing screen resolution

$ADB Shell WM Size

Physical size:1080x1920

viewing screen density

$ADB Shell wm Density

Physical density:480
There are too many commands on ADB, and the above lists only some of the commands I use more often, and here are more commands to see:

Https://github.com/mzlogin/awesome-adb

ADB idea
Do you think it is convenient to do the above order? But when we are developing with Android Studio, is it more convenient to have a plugin? So here's an as plugin for ADB idea, which is handy for quickly manipulating some of the ADB commands directly in as.

When the installation is complete, the shortcut key directly evokes:

Mac Osx:ctrl+shift+a
Windows/linux:ctrl+alt+shift+a
Look directly at the following:

Original address: http://www.androidstar.cn/adb operation Command Detailed and Daquan

Turn: ADB operations Command details and Daquan

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.