第一步:上传应用
adb push <apk当前绝对路径> <apk上传路径>
第二步:安装应用
adb shell pm install -t -r <apk所在路径>
第三步:查看包名
adb shell pm list package -f
第四步:查看启动Activity类名
4-1:adb shell
4-2: dumpsys package <应用包名>
4-3:找到Category为Launcher的Activity
第五步:启动应用
adb shell am start -n <应用包名>/<应用启动Activity绝对名称>
第六步:卸载应用
adb uninstall <应用包名>
PS:工作中可能会遇到卸载system下的应用,如果使用上面的命令就行不通了,可以尝试一下下面的命令:adb shell pm uninstall --user 0 <应用包名>
卸载
adb uninstall 包名
adb卸载系统应用
//卸载:
adb shell pm uninstall --user 0 应用包名
停用:
adb shell pm disable-user 应用包名
启用:
adb shell pm enable 应用包名
adb停止应用进程:
adb shell am force-stop 应用包名
adb获取root权限:
adb root
adb重新挂载:
adb remount
adb查看系统版本:
adb shell getprop ro.build.version.release
adb查看内存使用:
adb shell
cat /proc/meminfo
修改IP地址
adb shell ifconfig eth0 192.168.4.223 netmask 255.255.255.0
查看IP地址
adb shell netcfg
如何查看android设备属于什么架构的?
第一步:输入 adb shell 回车
第二步:cat /proc/cpuinfo 回车
adb命令打开手机设置页面:
设置主页面
adb shell am start com.android.settings/com.android.settings.Settings
安全
adb shell am start com.android.settings/com.android.settings.SecuritySettings
手机无线信息
adb shell am start com.android.settings/com.android.settings.RadioInfo
更多页面
com.android.settings.AccessibilitySettings 辅助功能设置
com.android.settings.ActivityPicker 选择活动
com.android.settings.ApnSettings APN设置
com.android.settings.ApplicationSettings 应用程序设置
com.android.settings.BandMode 设置GSM/UMTS波段
com.android.settings.BatteryInfo 电池信息
com.android.settings.DateTimeSettings 日期和坝上旅游网时间设置
adb拉取tombstones文件
adb pull /data/tombstones D:\
adb拉取anr文件
adb pull /data/anr/traces.txt
adb获取root权限
adb root
adb重新挂载
adb remount
adb查看系统版本
adb shell getprop ro.build.version.release
adb查看内存使用
adb shell
cat /proc/meminfo
查看设备IP信息
adb shell ifconfig
adb shell netcfg
adb命令打开手机设置页面
adb shell am start com.android.settings/com.android.settings.Settings
adb打开安全
adb shell am start com.android.settings/com.android.settings.SecuritySettings
adb启动系统相机并切换到拍照
adb shell am start -a android.media.action.STILL_IMAGE_CAMERA
adb关闭系统相机
adb shell am force-stop com.android.camera2
adb查找系统相机的包名
adb shell pm list packages | grep camera
adb logcat日志输出到指定路径文件
adb logcat -v time >D:log.txt
adb logcat查看指定包名日志
linux环境:
adb logcat | grep com.aniljing.demo
windows环境:
gitBash:
adb logcat | grep com.aniljing.demo
cmd:可以根据应用的进程ID (PID) 来过滤日志。首先需要获取应用的PID,然后过滤该PID的日志
1、获取应用的进程ID
adb shell pidof com.example.myapp
2、然后使用 --pid 选项来只显示该PID的日志
adb logcat --pid=<PID>