Android Debug - ADB(Android Debug Bridge)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u011391629/article/details/84664811

Overview

Android Debug Bridge (adb)就是command调试工具,可以让你与device连接。比如在PC上用命令控制Android Device。

那PC上要装驱动以便能识别到设备,Android Device需要是开发者模式,并且enable USB debugging。成功的话,使用adb devices命令,可以看到看到已连接的device。

Command

下面列出我目前长用到的adb命令,后面会直接把google资料的都贴过来。

#  这里可以直接把apk拖到Terminal
adb install [apk_name]     
# when you install a test APK(For example: Cts Verify里面的一些apk)
adb install -t [apk_name]  

# launcher activity
adb shell am start -n {package name}/{package name}.activity   
# look activity task
adb shell dumpsys activity activities   
# look service list
adb shell service list
# look pm features list
adb shell pm list features      

# input [touchscreen|touchpad|touchnavigation] tap 
adb shell input tap 100 100 
# input [touchscreen|touchpad|touchnavigation] swipe [duration(ms)]
adb shell input swipe 100 100 200 200 300
# root
adb root	
# Start a remote interactive shell in the target device
adb shell 	
# To copy a file or directory and its sub-directories to the device
# File from PC to Device, For example: adb push foo.txt /sdcard/foo.txt
adb push [local remote]
# File from Device to PC, For example: adb pull /sdcard/screen.png
adb pull [remote local]

# 看logcat,经常是adb logcat > log.log 直接在文件中看
adb logcat   

# screenrecord step
# step1: root
# step2: remount(get read&write permission)
# step3: screenrecord command
# step4: sync
# step5: devices -> PC
adb root      
adb remount  
adb shell screenrecord /sdcard/demo.mp4
adb shell sync
adb pull /sdcard/demo.mp4 E:\xxx

Global options

在这里插入图片描述

General commands

在这里插入图片描述

Networking commands

在这里插入图片描述

File transfer commands

在这里插入图片描述

App installation commands

在这里插入图片描述

Backup and restore commands

在这里插入图片描述

Debug commands

在这里插入图片描述

Security commands

在这里插入图片描述

Scripting commands

在这里插入图片描述

Internal debugging commands

在这里插入图片描述

Shell commands

在这里插入图片描述

Call activity manager(am)

For example:

adb shell am start -a android.intent.action.VIEW

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

Call package manager (pm)

For example:

adb shell pm uninstall com.example.MyApp

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

Call device policy manager (dpm)

adb shell dpm command

在这里插入图片描述

Take a screenshot

在这里插入图片描述

Record a video

在这里插入图片描述

在这里插入图片描述

Read ART profiles for apps

在这里插入图片描述

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/u011391629/article/details/84664811