Current location - Quotes Website - Signature design - Summary of adb commands commonly used in Android phones
Summary of adb commands commonly used in Android phones
I have long wanted to sort out some adb commands I usually use, not only to facilitate the later search, but also to review the sorting process myself. However, when I started searching for Du Niang, I found that many people wrote in great detail, especially when I found this ADB summary.

How can I write an NND in my heart in such detail that I suddenly lost my desire to write this article? If you click on the link and find it really complete, congratulations on closing this article, hahaha.

I don't think so. Although it's comprehensive, it's not what I usually use, and it varies from person to person, so I'll take notes and promote it to this buddy.

–-ADB devices, get a list of devices and their status.

The device has three states.

Equipment, equipment connection is normal.

Offline, equipment offline, abnormal connection.

Unauthorized devices need to be allowed to debug the dialog box on the device to get authorization.

The solution to offline situation is to execute adb kill-server command first, then adb start-server command, and then try to view the list with adb device. If it's still offline, come on, and we'll restart Dafa with the slaying skill.

When multiple android devices are connected to the computer and available, all adb commands need to be executed after the specified devices (of course, redundant devices can also be removed).

ADB-s & lt; Device name > install/uninstall /shell/pull/push and other commands.

–-ADB install app in the pc hard disk path, just select the app and drag it.

Common error situation

INSTALL_FAILED_TEST_ONLY, the debugging version of the installed app is unsigned, so you can install the adb install -t path.

Install _ failed _ duplicate _ package, an application with the same package name has already been installed. Please uninstall before installation.

–-ADB uninstalls the package name of the application and uninstalls the application.

Adb pull copies files or folders on Android devices locally.

ADB pull SD card/Android/ 1 1 1 . txt E:\

Tip: For easy viewing, you can specify the local path as the desktop. Hold down the shift key on the desktop, right-click the mouse to open the command line window here, and directly enter ADB pull SD card/Android/11.txt to execute, and you can copy111.txt to.

Provided that the device has been granted root privileges.

Adb root

ADB refinancing

Adb push copies files from pc to android devices, which is often used when modifying native applications in the room, such as settings.apk, launcher 3.apk.apk.

–-ADB shell pm command

The Adb shell pm list package lists all applications on android devices.

Adb shell pm list package -s lists the system-level applications on android devices.

Adb shell pm list package -3 lists third-party applications (installed by users) on android devices.

Adb shell pm list package -f lists the app package name, corresponding apk name and storage location.

Adb shell pm list package -i lists the app package name and its installation source (application market name).

The adb shell pm dump app package lists the relevant information of the app, which is similar to getting the contents of the Manifest file.

-Check front desk activities

Adb shell dump system activity "| grep mFocusedActivity"

-adb shell am command

The most commonly used is to start a specified activity and send a specified broadcast.

Start the specified activity.

Operation description adb shell am start -n package name/class name

Note: If the following error occurs when starting the activity.

Java.lang.SecurityException: permission denied: startup intention {FLG = 0x1000000 > & gt CMP = com.mediatek.engineermode/.io.gpio} is not exported from null (pid=3083, uid=2000) but from uid 100 1

Solution, 1. If it is your own controllable app, find the activity you want to call in manifest.xml and add it.

1

Just configure it. Android:name= ""can be an empty string.

2. If it is an uncontrollable app, such as the system native app I called, then you should wash and sleep, and don't toss it, unless you modify the source code as above, and push it again to replace the original app.

Start the default browser to open the web page.

ADB shell am start-a Android . intent . action . view-d? * ********

Stop the target application before starting it.

Asian Development Bank Shell Oil Company com.android.camera/.Camera Branch

Start the camera

The Asian Development Bank Shell Company started in com.android.camera/.Camera.

Startup setting

The Asian Development Bank Shell Company started in com.android.settings/com.android.settings.Settings.

Start Wifi settings

The Asian Development Bank Shell Company started in com.android.settings/com.android.settings.wifi.WifiSettings.

Start bluetooth settings

Adb shell amstart-ncom.android.settings/com.android.settings.bluetooth.bluetooth settings

As long as you can find the configuration in manifest, you can call other similar ones in this way.

Send the specified broadcast

Operation description adb shell am broadcast -a broadcast name -ei/es/ez parameter name parameter value -ei/es/ez parameter name parameter value.

--ei integer value

–-esstring value

–ez boolean value

–– --ef floating-point value

–lasting value

For example, it was written before.

Dynamic addition and static addition of configuration list items modified by Android6.0 source code, in which the added configuration list items are received by sending broadcast.

Adb shell am broadcast-a cn.dynamic.add.setting category project-elocation "0-2"-esdile "red"-eintent "com.android.settings.schedule _ power _ on _ off _ setting"

-adb shell input key code instruction

Home key adb shell input key code 3

Back key adb shell input key code 4

Open the browser adb shell and enter the key code 64.

-ADB Shell wm Directive

Screen resolution adb shell wm size

Screen density adb enclosure wm density

Adb shell wm density 320/480/640 can modify the viewing effect of screen density, and the corresponding launcher icon will be scaled.

Adb shell ifconfig command

IP address adbshell ifconfig "| grepmask"

WIFI address adb shell ifconfig wlan0

The display of the status bar and navigation bar is hidden.

Command:

Adb shell settings will be global policy _ control

It can be composed of the following keys and their corresponding values in the format of key1= value1:key 2 = value2.

Key meaning

Immersive. full simultaneous hiding

Invisible. State hides the status bar.

Immersive.navigation hides the navigation bar.

Immersion. Pre-confirmation simultaneous display

The values corresponding to these keys can be combined with commas, as follows:

Value meaning

Apply all applications

All interfaces

Packagename specifies the application.

Packagename excludes the specified application.

For example:

Adb shell settings incorporate global policy control into it. full=*

Indicates that the status bar and navigation bar are hidden in all interfaces. (Restart will not fail, and the following commands are required for recovery. )

Adb shell settings incorporate global policy control into it. preconfirms=*

Indicates that the display has been restored.

The adb shell setting sets the global policy _ controlimmersive.status = com.package1,com.package2: immersive.navigation = apps,-com.package3.

This means that the status bar is hidden in applications with package names com.package 1 and com.package2, and the navigation bar is hidden in all applications with package names com.package3. ..

Adb shell am force-stop app? Close the application

Adb shell pm clear APP? The app process is killed, and all the data will be clear.

1: Find the package name of mobile phone installation application: adb shell pm list packages -f F f.

2. Check the system drive letter: adb shell df.

3. Check the log1:adbshell2: logcat | grep "ABC".

4. Delete the application: 1:adbremount? 2: ADB shell? 3:cdsystem/app 4:rm *。 apk

5: install apk: adbinstall-r *. apk? Or ADB pushes *. apk? /system/application

6: Check the time indication when the APP starts.

? The Asian Development Bank Shell Company is located at -ncom.android.dialer/ west. DialtactsActivity? (w capital) The APP will start automatically after executing the command, and ThisTime is this time? The time required for the application to start.

7. View the current process information in the package name: ADB shell PS | grep+ package name.

8. View the task stack where the activity is running: adb shell dumpsys activity.

? 9. Check the key value: adblogcat | grepincep? [plural of nouns from Latin ending in -us]

10: check the CPU resources occupied by the module: adb shell top -d 2 -m 10.

1 1: Permission to view available systems.

? $ TERM ADB shell

? # pm list permissions

12: analog key input: adb shell input keyevent+key value.

? For example:? Adb shell input key event? 82 stands for menu

? Adb shell input key event? 3? Representative home

? Adb shell input key event? 19 means up.

? Adb shell input key event? 20 means downward.

? Adb shell input key event? 2 1 means to the left.

? Adb shell input key event? 22 stands for right.

? Adb shell input key event? 66 stands for entry

? Adb shell input key event? 4? Represents the back

13: analog sliding input: ADB shell input touch screen < x1><y1> & ltx2 & gt& lty2 & gt

For example: adb case input touch screen slides 18 665 18 350.

14: start an activity: adb shell am start -n package name+class name.

15: Recording screen: ADB screenrecord/SD card/demo.mp4.

16: reboot: adb reboots.

17: Basic Usage of Monkey The following is a typical command line example, which starts the specified application and sends 500 pseudo-random events to it:

$ TERM shell monkey -p your.package.name -v 500

If you run monkey on the desktop or system interface:

ADB Shell Monkey -v -v -p Desktop Package Name-PCT-Touch 50-PCT-Motion 30-PCT-Sykeys 20-Throttle 300-S 200 200000

18: Find the details of third-party applications:

Adb shell dumpsys package+third party package name (com.txznet.webchat)