Use topics for --ADB command

Use ADB commands
A, ADB Introduction
adb (Android Debug Bridge) is a generic command-line tool, which allows you to simulator instance or Android device connected for communication. It provides convenient operations for a variety of devices, such as application installation and commissioning
 
Two, ADB's use
1. List all attached devices: adb devices
 
2. List all installed apk package: adb shell pm list packages
3. List the system application apk package: adb shell pm list packages -s
4. List the third-party application apk package: adb shell pm list packages -3
 
The setup application: adb install -r [apk File]
-l: the application will be installed to protect the directory / mnt / asec do not understand
-r: Allow mounting cover
-t: Allow installation like the write Han Han Han
-d: cover allows installation Downgrade
-s: install the application to sdcard
-g: All authorized permission to run
The application is installed to a certain device
adb -s cf7878sd (device name) install test.apk
 
6. Review the installation path: adb shell pm path [apk package name]
 
7. uninstall the application: adb shell uninstall [apk package name]

 

 

-k # do not delete running generated data and cache directory (such as database software file)
例:adb uninstall -k com.tencent.mm
 
7. Clear app cache information: adb shell pm clear [package package name]
例:adb shell pm clear cn.xlink.xxxx
Expand learning: can be used to test the app, the app after clearing the cache for the app to use any influence, for clearing data validation app, you can also have the following methods: clean up (such as 360 guards) through third-party software on the app, go to the phone settings page, program management, active clearing data (test point and if this feeling was developed know, it might be hit)
 
8.查看前台activity:adb shell dumosys activities | findstr mFocusedActivity
adb shell dumpsys activity | grep -i run
 
9. View running services: adb shell dumpsys acivity services [package name]
 
10. The launch specific applications APP: adb shell am start -n [apk package name] / [promoter activity, also known MainActivity]
例:adb shell am start -n cn.xlink.zensun/cn.xlink.park.modules.splash.view.SplashActivity
 
11 forcibly stops the application: adb shell am force-stop [package name]
例:adb shell am force-stop cn.xlink.zensun
 
12. Review Application Details: adb shell dumpsys package [package name]
例:adb shell dumpsys package cn.xlink.zensun
 
For dumpsys use: Reference Link: https://www.jianshu.com/p/e710fe2410ca
adb shell dumpsys XXX
 

 

 

13. Review Screen resolution: adb shell wm size

Modify the screen resolution: adb shell wm size 720x1024
Problems may arise can not be modified, as shown below:

 

 Solution:

Go to the phone settings page, the developer options open safe
 
Wireless connections
1. phone and computer connected to the same network
2. Check the phone connection is successful: adb devices
3. Allow the device in 5555 listening port TCP / IP connections: adb tcpip 5555
4. disconnect the USB
5. View the IP address: adb shell ifconfig | findstr Mask
6. The connection device via ip: adb connect <device-ip-address>
7. verify that the connection is successful: adb devices, appears <device-ip-address>: 5555 device, connection is successful

 

 

Third, incurable diseases
1.adb devices can not find the device (some phones may be partly not, can not rule out the problems caused by the installation drive), the solution can refer to: https: //jingyan.baidu.com/article/ce09321b5b76642bff858f31.html
Generally: find the phone device hardware id, id hardware and can be added to adb_usb.ini
 
Tip 2. Use the grep command: grep 'is not an internal or external command, operable program or batch file
There are two solutions:
First, the back of the adb shell double quotes

 

Two, to replace grep findstr

 

 

Guess you like

Origin www.cnblogs.com/cubictest/p/11923717.html