首页 > 其他分享 >【汇总】android adb 命令功能大全

【汇总】android adb 命令功能大全

时间:2023-12-27 15:11:20浏览次数:45  
标签:shell mobile adb test android 设备 com 大全

前言全局说明

adb 命令是 Android 官方提供,调试 Android 系统的工具。


一、基础命令

adb reboot #重启
adb help #查看ADB 帮助

二、查看设备

adb devices #查看连接设备

三、连接设备

adb [-d|-e|-s <serialNumber>] <command>
连接指定设备

参数:
-d 指定当前唯一通过USB 连接的Android 设备为命令目标
-e 指定当前唯一运行的模拟器为命令目标
-s <serialNumber> 指定相应serialNumber 号的设备/模拟器为命令目标
command 为所需对设备执行的命令

示例:

adb -s cf27456f shell # 指定连接设备使用命令

四、安装、卸载APP应用

1.安装应用

adb install test.apk # 安装应用
adb install -r demo.apk #安装apk 到sd 卡:

2.卸载应用

adb uninstall cn.com.test.mobile #卸载应用,需要指定包
adb uninstall -k cn.com.test.mobile #卸载app 但保留数据和缓存文件

五、adb shell

1.adb shell am

adb shell am start -ncn.com.test.mobile/.ui.SplashActivity #启动应用
adb shell am force-stop cn.com.test.mobile #强制停止应用

2.adb shell pm

adb shell pm list packages #列出手机装的所有app 的包名
adb shell pm list packages -3 #列出除了系统应用的第三方应用包名
adb shell pm clear cn.com.test.mobile #清除应用数据与缓存

3.adb shell dumpsys

adb shell dumpsys package #包信息Package Information
adb shell dumpsys meminfo #内存使用情况Memory Usage

4.adb shell getprop

adb shell getprop ro.build.version.release #查看Android 系统版本

5.adb shell top

adb shell top -s 10 #查看占用内存前10 的app

六、上传、下载文件

adb push <local> <remote> #从本地复制文件到设备
adb pull <remote> <local> #从设备复制文件到本地

七、log & bug log

adb logcat #查看日志
adb logcat -c #清除log 缓存
adb get-serialno #获取序列号
adb bugreport #查看bug 报告


免责声明:本号所涉及内容仅供安全研究与教学使用,如出现其他风险,后果自负。




参考、来源:
https://blog.csdn.net/y281252548/article/details/130619040



标签:shell,mobile,adb,test,android,设备,com,大全
From: https://www.cnblogs.com/wutou/p/17930583.html

相关文章

  • Uniapp的android版本的证书制作
    一、查看Java安装路径java-XshowSettings:properties-version二,生成证书指令Enterkeystorepassword://输入证书文件密码,输入完成回车Re-enternewpassword://再次输入证书文件密码,输入完成回车Whatisyourfirstandlastname?[Unknown]:qhweb//输入名字和姓氏,输......
  • 解决Linux环境下Android调试adb没有权限问题
    转载自:https://codeleading.com/article/1564378047/问题描述adbdevicesnopermission(userxxxisnotintheplugdevgroup);see[http://developer.android.com/tools/device.html]解决方案在/etc/udev/rules.d/目录下创建文件:51-android.rules,并在文件中填入如......
  • Android 蓝牙相关
    Android蓝牙相关本文主要讲述android蓝牙的简单使用.1:是否支持蓝牙/***是否支持蓝牙**@return*/privatebooleanisSupportBluetooth(){BluetoothAdapterbluetoothAdapter=BluetoothAdapter.getDefaultAdapter();returnbluetoothAdapter!=nul......
  • Android 获取进程名称
    Android获取进程名称本篇文章主要获取下当前应用的进程名称,具体代码如下:publicstaticStringgetProcessNameDevice(finalContextcontext){intmyPid=Process.myPid();if(context==null||myPid<=0){return"";}ActivityManager.......
  • Android 依据Build相关信息判断机型
    Android依据Build相关信息判断机型本文主要通过Build的相关信息获取机型,目前机型判断的较少,后续继续维护更新publicstaticStringparseBuild(){StringBuildersb=newStringBuilder();StringderiveFingerprint=Build.FINGERPRINT;Stringmanufacturer......
  • Android BluetoothAdapter 使用(二)
    AndroidBluetoothAdapter使用(二)本篇文章主要讲下蓝牙设备的配对.1:蓝牙设备列表展示下面是蓝牙设备adapter的代码:packagecom.test.bluetooth;importandroid.bluetooth.BluetoothDevice;importandroid.content.Context;importandroid.view.LayoutInflater;impo......
  • Android Notification 以及 通知铃音使用
    AndroidNotification以及通知铃音使用上一篇文章讲了手机震动的使用.本篇继续讲解铃音的使用,并且在讲下通知消息的使用.1:通知消息的使用代码如下:publicstaticvoidnotice(Contextcontext){try{NotificationCompat.Builderbuilder=ne......
  • Android Vibrator 手机震动
    AndroidVibrator手机震动本篇文章主要讲下手机震动.1:检测是否支持震动/***@paramcontext*@return*是否支持手机震动*/publicstaticbooleanhasVibrator(Contextcontext){ObjectsystemService=context.getSystemService(Context.VIBRATOR_SERVICE);......
  • android-studio-2021.1.1.11-windows 版本遇到的各种大坑
    1、使用2023.12月的最新版本会无法选择java语言开发,所以必须选择较老的版本,比如我选择的android-studiobumbblebee 2021.1.1.11这个版本就可以选择java语言。2、不光需要设置代码自动补全提示,更重要的是最新的SDK,androidapi34有bug,无法语法提示,也可能是不支持我所使用的语......
  • P2865 [USACO06NOV] Roadblocks G
    原题链接题解1.在处理最短路的时候,我们采用优先队列的方法,即第一个出现的点一定是最小的,之后出现的点都是在其他点的基础上叠加的值,肯定不小于第一个。那么依然是这个思路,第二个出现的点一定是次短的。代码#include<bits/stdc++.h>usingnamespacestd;structunit{in......