The common adb commands and error abnormal operation

  adb connection state


  • adb devices, get a list of equipment and equipment status
  • There are three state devices
  • device, the device connected to the normal
  • Offline, the device is offline, connected abnormal
  • unauthorized equipment to authorize, whether to allow debugging dialog box requires authorization on the device
  • adb install app in the path pc hard disk, select the app you can directly drag

  • Common error conditions
  1. INSTALL_FAILED_TEST_ONLY, install the debug version of the app, unsigned, adb install -t path to install
  2. INSTALL_FAILED_DUPLICATE_PACKAGE, have installed the same package name of the app, uninstall and install
  • adb uninstall app package name, uninstall app
  • adb pull the file or folder on your Android device to your local copy
  • adb pull sdcard/Android/111.txt E:

Tips, local path can be specified as a desktop for easy viewing, hold down the shift key on the desktop, right-click and select Open command window here, directly enter adb pull sdcard / Android / 111.txt execution, it can be 111. txt copied to the desktop.

  • Provided that the equipment has been acquired root privileges
  • adb root
  • adb remount
  • adb push files to be copied on the pc android device, frequently used to modify room native application, such as settings.apk, launcher3.apk
  • command adb shell pm
  • adb shell pm list package lists all the app on the android device
  • adb shell pm list package -s lists the system-level app on android devices
  • adb shell pm list package -3 listed on the third party app android device (user-installed)
  • adb shell pm list package -f listed apk app name and storage location and the corresponding package name
  • adb shell pm list package -i list app package name and install the source (application market name)
  • adb shell pm dump app package name lists information about the app, similar to obtain Manifest file contents

Front View Activity


  • adb shell dumpsys activity activities "| grep mFocusedActivity"
  • adb shell am command

  1. The most common is to start the specified activity and transmit specified broadcast
  2. Start the specified activity

   

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

NOTE: If the starting activity, there are mistakes
java.lang.SecurityException: Permission Denial: starting Intent { flg = 0x10000000>> cmp = com.mediatek.engineermode / .io.Gpio} from null (pid = 3083, uid = 2000 ) not exported from uid 1001

Solution, 1, if it is your own controllable app, then find you want to call activity in manifest.xml, increasing

Configured to, android: name = "" can be the empty string.

2, if it is not controlled app, for example, a system I call the native app, then you wash sleep, do not toss, unless you modify the source code and the same operation on top, re-push to replace the original app.

  • Launch the default browser opens a Web page

adb shell am start -a android.intent.action.VIEW -d http://testerhome.com

  • Stop the target application, and then start

adb shell am start -s com.android.camera/.Camera

  • Activate the camera

adb shell am start -n com.android.camera/.Camera

  • Startup Settings

adb shell am start -n com.android.settings/com.android.settings.Settings

  • Wifi is set to start

adb shell am start -n com.android.settings/com.android.settings.wifi.WifiSettings

  • Start Bluetooth settings

adb shell am start -n com.android.settings/com.android.settings.bluetooth.BluetoothSettings

  • Send specify a broadcast

Operation instruction adb shell am broadcast -a broadcast name --ei / es / ez Parameter Value --ei / es / ez Parameter Value

  1. --ei integer value
  2. --es String value
  3. --ez boolean 值
  4. --ef float value
  5. --el long value

For example, before writing the
Android6.0 source code to modify the list of Setting configuration item to add dynamic and static additions, which will be received by sending a broadcast to increase the allocation list items

adb shell am broadcast -a cn.dynamic.add.settingcategoryitem --es location "0-2" --es title "红" --es intent "com.android.settings.SCHEDULE_POWER_ON_OFF_SETTING"

adb shell input keycode 指令

HOME 键 adb shell input keycode 3

Back key adb shell input keycode 4

Open your browser adb shell input keycode 64

   adb shell wm command

  1. Screen resolution adb shell wm size
  2. Adb shell wm density screen density

adb shell ifconfig 命令

  1. IP 地址 adb shell ifconfig "| grep Mask"
  2. WIFI 地址 adb shell ifconfig wlan0
  • Displays the status and navigation bars are hidden

  adb shell settings put global policy_control

  By following several keys and corresponding values ​​with the format key1 = value1: key2 = value2.

  key meaning

  1. immersive.full while hiding
  2. immersive.status hide the status bar
  3. immersive.navigation hide the navigation bar
  4. immersive.preconfirms displayed simultaneously

value meaning

  1. All applications apps
  2. 所有界面
  3. packagename specified application
  4. -packagename exclude specific applications 
  • Express settings while hiding the status bar and the navigation bar at all interfaces. (Restart will not fail to be called to restore the following commands)

  adb shell settings put global policy_control immersive.full=*

  • Display indicates the recovery

adb shell settings put global policy_control immersive.preconfirms=*

  • Set expressed hide the status bar in the application package name com.package1 and com.package2's, in addition to all the application's package name com.package3 hide the navigation bar.

  adb shell settings put global policy_control immersive.status=com.package1,com.package2:immersive.navigation=apps,-com.package3

 

Guess you like

Origin www.cnblogs.com/WCQ-berly/p/11982925.html