Adb commonly used and easy to use several commands

The following is a personal summary of commonly used and very easy to use adb instructions

Adb common command usage guide, hope it will be helpful to you

1, adb devices view device list

2. adb get-state get the connection status device offline unkown

View the list of connected Android devices on the computer, multi-line display means that multiple Android devices are connected, and the string in front of each line represents the SN number of the Android device

3. adb install -r APK path to install the application

The file path where the apk file is located, including apk, such as D:/hello.apk, please note that the cmd path that needs to be opened should not contain Chinese, otherwise, some computers may prompt that the installation fails

4. Adb uninstall application package name, application uninstallation Check the package name installed by yourself, adb uninstall -k hello.apk download the application, but keep the cached data

5. Adb connect device ip address, if the computer and the device are in the same local area network, the connection ip address of the Android device can be successfully connected

6. adb push the file path on the computer sdcard/ input the computer file into the phone

Such as file D:/hello.apk, adb push D:/hello.apk /sdcard, hello.apk

7. The pc directory specified by adb pull /sdcard/ file path, copy the file to the pc, the file save path is directly the same as the path opened by cmd

8. adb reboot device to restart

9, adb shell pm clear package name to clear application data

10 adb shell pm list packages -3 View the package name of the application installed by the third party. Before uninstalling the application, you can generally use this command to view the package name

11. adb shell am force-stop package name to close the application

12. adb shell screencap /sdcard/screen.png screenshot

13. Adb shell screenrecord /sdcard/hello.mp4 screen video recording, which can be used during testing

14, adb logcat grab log

If you want to filter the log, you can use adb logcat | findstr "input filtered content"

15, adb shell wm size view screen size
16, adb shell getprop view configuration information

Such as: adb shell getprop ro.build.version.sdk to view the api version

17, adb shell input keyevent 4 Return to the previous page

18. adb shell df view mobile phone storage information

19. adb shell pm disabel-user com.android.launcher3 disable system applications

20, adb shell pm enable com.android.launcher3 to enable the system, root permissions are required

21, adb start-server //Restart the adb service process

22, adb shell cat /sys/class/net/wlan0/address //Get mac address

23、  adb shell monkey -p 包名 --throttle 100 --ignore-crashes --ignore-timeouts --ignore-security-exceptions --ignore-native-crashes --monitor-native-crashes -v -v -v –s 1540475754297 100  monkey测试

24, adb shell ls /system/bin View all the commands that can be used by the current device

25. adb shell input text "www.baidu.com", enter the edit text in the edit text box

26, adb shell svc wifi enable | disable Turn on or off wifi

27, adb shell svc data enable |disable Turn on or off the mobile network

28. adb shell input swipe 760 500 600 320 Click on the screen, click according to the actual coordinates

29, adb shell mkdir /sdcard/ to create a directory

30. cat /proc/cpuinfo // View CPU information, if it is memory, then cat/proc/meminfo

31. cat /data/misc/wifi/*.conf to view the wifi password, root permission is required

Some students may not have configured the adb environment, additional environment configuration

1. Adb environment configuration, first go to the official website to download  https://adbshell.com/downloads , and decompress after downloading. The following takes windows as an example to configure the adb environment. After decompression, save the file to D drive D:\adb

1. Enter the computer, enter the search directory  Control Panel\System and Security\System, click Advanced System Settings, and enter as shown in the figure 

2. Double-click the environment variable of the environment path, such as an arrow, and add a semicolon in the English state; then add D:\adb, and then click apply, as shown in the figure

 

 

 

 

Guess you like

Origin blog.csdn.net/romygreat/article/details/114927095