adb shell使用说明

实际中有些adb.exe在目录 D:\android-sdk-windows\platform-tools下面
创建A VD(模拟器):
android create avd --name 名称--target 平台编号
4. 启动模拟器:
emulator -avd 名称-sdcard ~/名称.img (-skin 1280x800)
5. 删除A VD(模拟器):
android delete avd --name 名称
6. 创建SDCard:
mksdcard 1024M ~/名称.img
7. A VD(模拟器)所在位置:
Linux(~/.android/avd) Windows(C:\Documents and Settings\Administrator\.android\avd) 8. 启动DDMS:
ddms
9. 显示当前运行的全部模拟器:
adb devices
10. 对某一模拟器执行命令:
abd -s 模拟器编号命令
11. 安装应用程序:
adb install -r 应用程序.apk
12. 获取模拟器中的文件:
adb pull <remote> <local>
13. 向模拟器中写文件:
adb push <local> <remote>
14. 进入模拟器的shell模式:
adb shell
15. 启动SDK,文档,实例下载管理器:
android
16. 缷载apk包:
adb shell
cd data/app
rm apk包
exit
adb uninstall apk包的主包名
adb install -r apk包
17. 查看adb命令帮助信息:
adb help
18. 在命令行中查看LOG信息:
adb logcat -s 标签名
19. adb shell后面跟的命令主要来自:
源码\system\core\toolbox目录和源码\frameworks\base\cmds目录。

20. 删除系统应用:
adb remount (重新挂载系统分区,使系统分区重新可写)。

adb shell
cd system/app
rm *.apk
21. 获取管理员权限:
adb root
22. 启动Activity:
adb shell am start -n 包名/包名+类名(-n 类名,-a action,-d date,-m MIME-TYPE,-c category,-e 扩展数据,等)。

23、发布端口:
你可以设置任意的端口号,做为主机向模拟器或设备的请求端口。

如:
adb forward tcp:5555 tcp:8000
24、复制文件:
你可向一个设备或从一个设备中复制文件,
复制一个文件或目录到设备或模拟器上:
adb push <source> <destination></destination></source>
如:adb push test.txt /tmp/test.txt
从设备或模拟器上复制一个文件或目录:
adb pull <source> <destination></destination></source>
如:adb pull /addroid/lib/libwebcore.so .
25、搜索模拟器/设备的实例:
取得当前运行的模拟器/设备的实例的列表及每个实例的状态:
adb devices
26、查看bug报告:
adb bugreport
27、记录无线通讯日志:
一般来说,无线通讯的日志非常多,在运行时没必要去记录,但我们还是可以通过命令,设置记录:
adb shell
logcat -b radio
28、获取设备的ID和序列号:
adb get-product
adb get-serialno
29、访问数据库SQLite3
adb shell
sqlite3
#cd system/sd/data //进入系统内指定文件夹
#ls //列表显示当前文件夹内容
#rm -r xxx //删除名字为xxx的文件夹及其里面的所有文件
#rm xxx //删除文件xxx
#rmdir xxx //删除xxx的文件夹
有时我们需要删除android模拟器或手机上的sd卡文件,特别是模拟器上的,这时我们就需要借助于一些命令来帮助我们删除文件。

#重新挂载模拟器
adb remount
#开始shell命令
adb shell
#进入到sdcard卡目录
cd sdcard
#将列出所有文件夹
ls
#删除文件或文件夹
rm -r (文件夹名称)。

合集下载

adb shell 使用方法

adb shell 使用方法

adb shell的使用方法包括以下步骤:
1. 连接设备:首先确保设备已经连接到电脑,并且已经安装好ADB驱动。

2. 进入shell环境:在电脑的命令行界面输入adb shell命令,即可进入设备的shell环境。

3. 执行命令:在shell环境下,你可以输入各种Linux命令来操作设备。

4. 退出shell环境:输入exit命令或者按Ctrl+D即可退出shell环境。

需要注意的是,不同的设备可能会有不同的ADB版本和功能,因此在使用adb shell时,需要先了解设备支持的ADB版本和功能,并且根据具体情况进行操作。

同时,为了确保设备的安全性,建议在操作完成后及时退出shell环境。

adb工具使用教程

adb工具使用教程

adb工具使用教程ADB(Android Debug Bridge)是一种开发工具,用于与Android设备建立通信连接并进行调试和测试。

它可以通过USB或网络连接将计算机与Android设备连接起来,以便开发人员可以访问设备的文件系统、运行shell命令、安装和卸载应用程序以及执行其他各种任务。

以下是一个ADB工具的使用教程。

第一步:安装ADB工具在开始使用ADB之前,需要先在计算机上安装ADB工具。

ADB工具包含在Android SDK中,可以从官方Android开发者网站下载和安装。

安装后,在计算机的命令行界面(Windows上是命令提示符,Mac和Linux上是终端)中输入ADB命令,如果显示了ADB的帮助信息,则表示安装成功。

第二步:连接设备要使用ADB工具与设备建立连接,首先需要在设备上启用开发者选项和USB调试模式。

这可以在设备的设置菜单中进行设置。

启用USB调试后,将设备通过USB线缆连接到计算机。

第三步:验证连接在计算机的命令行界面中输入`adb devices`命令,如果设备连接成功,则会列出连接的设备的序列号。

如果没有显示设备,则可能是USB驱动程序没有正确安装,需要安装正确的驱动程序。

第四步:常用ADB命令ADB工具有很多命令,用于执行各种任务。

以下是一些常用的ADB命令:1. `adb shell`: 这个命令用于在设备上打开一个远程的shell会话,可以在设备上执行命令。

2. `adb install`: 这个命令用于安装一个应用程序的APK文件到设备上。

3. `adb uninstall`: 这个命令用于卸载一个应用程序。

4. `adb push`: 这个命令用于将文件从计算机推送到设备。

5. `adb pull`: 这个命令用于将文件从设备拉取到计算机。

6. `adb logcat`: 这个命令用于查看设备的日志信息。

7. `adb reboot`: 这个命令用于重新启动设备。

adb shell date用法

adb shell date用法

adb shell date用法adb shell date是一种在Android设备中配置和查看日期和时间的命令。

此命令可用于更改设备时区、日期时间等系统设置。

下面将介绍adb shell date的用法和相关参考内容。

1. adb shell date命令用法adb shell date命令可用于以下方面:1) 显示设备当前的日期和时间:$ adb shell date该命令可输出如下内容:Wed Aug 11 16:25:20 IST 20212) 设置设备的日期时间,需要指定日期、时间和格式:$ adb shell date -s "YYYY/MM/DD HH:MM:SS"例如,将设备的日期时间设置为2021年8月11日16时30分30秒:$ adb shell date -s "2021/08/11 16:30:30"该命令可输出如下内容:Wed Aug 11 16:30:30 IST 20213) 设置设备的时区:$ adb shell setprop persist.sys.timezone "时区"例如,将设备的时区设置为北京标准时间:$ adb shell setprop persist.sys.timezone "Asia/Shanghai"2. 相关参考内容adb shell date是一个基本的Android命令,广泛应用于调试和开发中。

此外,以下第三方网站提供了有关adb shell date命令的有用信息:1) adb shell命令详解该网站提供有关adb shell的详细信息,包括adb shell date命令的用法、示例和说明。

2) Android开发者官网Android开发者官网是开发Android应用程序的重要资源之一。

在官网上,您可以获得有关adb shell date命令的详细信息,包括如何使用该命令更改设备时区、日期时间等系统设置。

adb shell相关操作

adb shell相关操作

adb shell相关操作
adb shell是Android Debug Bridge (ADB) 工具的一部分,它允许开发人员通过命令行界面与Android设备进行交互。

以下是一些常见的adb shell相关操作:
1. 进入设备的shell环境:
```
adb shell
```
这将打开一个类似于终端的命令行界面,您可以在其中执行设备上的命令。

2. 运行设备上的命令:
在adb shell中,您可以运行任何适用于设备的命令。

例如,您可以运行以下命令来查看设备的文件列表:
```
ls
```
或者您可以运行以下命令以root权限运行命令:
```
su
```
3. 复制文件到设备:
```
adb push <本地文件路径> <设备目标路径>
```
这将把本地文件复制到设备上的指定路径。

4. 从设备复制文件到本地:
```
adb pull <设备路径> <本地目标路径>
```
这将从设备上指定路径复制文件到本地目标路径。

5. 安装应用程序:
```
adb install <应用程序路径>
```
这将安装位于本地路径上的应用程序到设备上。

6. 卸载应用程序:
```
adb uninstall <应用程序包名>
```
这将卸载设备上指定包名的应用程序。

这些是使用adb shell进行一些常见操作的示例。

通过使用adb shell,您可以与设备进行交互,并运行各种命令来进行开发和调试。

adb shell bugreport 使用

adb shell bugreport 使用

adb shell bugreport 使用摘要:1.ADB shell bugreport 简介2.使用ADB shell bugreport 的步骤3.ADB shell bugreport 的作用和优势4.结束语正文:1.ADB shell bugreport 简介ADB(Android Debug Bridge)是一种用于管理Android 设备的工具,可以通过命令行或脚本进行操作。

其中,ADB shell bugreport 是一个用于收集Android 设备崩溃日志的工具,可以帮助开发者定位并修复应用程序中的错误。

2.使用ADB shell bugreport 的步骤使用ADB shell bugreport 的步骤如下:1) 首先,确保你的Android 设备已经连接到电脑,并且ADB 已经正确安装和配置。

在命令行中输入“adb devices”以查看已连接的设备列表。

2) 在命令行中输入“adb she ll bugreport --install”以安装bugreport 工具。

安装完成后,你可以在Android 设备上输入“bugreport”查看相关帮助信息。

3) 在Android 设备上运行你的应用程序,触发崩溃。

当应用程序崩溃时,系统会自动收集崩溃日志。

4) 使用ADB pull 命令将崩溃日志从Android 设备上拉取到电脑。

在命令行中输入“adb pull /data/anr/traces /path/to/save/traces”以将崩溃日志保存到电脑上的指定路径。

5) 使用Android Studio 打开保存在电脑上的崩溃日志文件,分析并修复应用程序中的错误。

3.ADB shell bugreport 的作用和优势ADB shell bugreport 的主要作用是方便开发者收集和分析Android 设备上的崩溃日志,从而快速定位并修复应用程序中的错误。

其优势在于:1) 自动化:在应用程序触发崩溃时,bugreport 工具会自动收集崩溃日志,无需手动操作。

adbshell命令模拟按键输入input使用keycode列表详解

adbshell命令模拟按键输入input使用keycode列表详解

adbshell命令模拟按键输⼊input使⽤keycode列表详解在adb shell⾥有⼀个⾮常使⽤的命令,模拟按键输⼊,这⾥⾸先不要理解为是键盘的模拟按键,下⾯命令的使⽤和键值做⼀个详解。

input命令格式adb shell input keyevent <keycode><keycode>对应的数值在android源码中定义如下/** Key code constant: Unknown key code. */public static final int KEYCODE_UNKNOWN = 0;/** Key code constant: Soft Left key.* Usually situated below the display on phones and used as a multi-function* feature key for selecting a software defined function shown on the bottom left* of the display. */public static final int KEYCODE_SOFT_LEFT = 1;/** Key code constant: Soft Right key.* Usually situated below the display on phones and used as a multi-function* feature key for selecting a software defined function shown on the bottom right* of the display. */public static final int KEYCODE_SOFT_RIGHT = 2;/** Key code constant: Home key.* This key is handled by the framework and is never delivered to applications. */public static final int KEYCODE_HOME = 3;/** Key code constant: Back key. */public static final int KEYCODE_BACK = 4;/** Key code constant: Call key. */public static final int KEYCODE_CALL = 5;/** Key code constant: End Call key. */public static final int KEYCODE_ENDCALL = 6;/** Key code constant: '0' key. */public static final int KEYCODE_0 = 7;/** Key code constant: '1' key. */public static final int KEYCODE_1 = 8;/** Key code constant: '2' key. */public static final int KEYCODE_2 = 9;/** Key code constant: '3' key. */public static final int KEYCODE_3 = 10;/** Key code constant: '4' key. */public static final int KEYCODE_4 = 11;/** Key code constant: '5' key. */public static final int KEYCODE_5 = 12;/** Key code constant: '6' key. */public static final int KEYCODE_6 = 13;/** Key code constant: '7' key. */public static final int KEYCODE_7 = 14;/** Key code constant: '8' key. */public static final int KEYCODE_8 = 15;/** Key code constant: '9' key. */public static final int KEYCODE_9 = 16;/** Key code constant: '*' key. */public static final int KEYCODE_STAR = 17;/** Key code constant: '#' key. */public static final int KEYCODE_POUND = 18;/** Key code constant: Directional Pad Up key.* May also be synthesized from trackball motions. */public static final int KEYCODE_DPAD_UP = 19;/** Key code constant: Directional Pad Down key.* May also be synthesized from trackball motions. */public static final int KEYCODE_DPAD_DOWN = 20;/** Key code constant: Directional Pad Left key.* May also be synthesized from trackball motions. */public static final int KEYCODE_DPAD_LEFT = 21;/** Key code constant: Directional Pad Right key.* May also be synthesized from trackball motions. */public static final int KEYCODE_DPAD_RIGHT = 22;/** Key code constant: Directional Pad Center key.* May also be synthesized from trackball motions. */public static final int KEYCODE_DPAD_CENTER = 23;/** Key code constant: Volume Up key.* Adjusts the speaker volume up. */public static final int KEYCODE_VOLUME_UP = 24;/** Key code constant: Volume Down key.* Adjusts the speaker volume down. */public static final int KEYCODE_VOLUME_DOWN = 25;/** Key code constant: Power key. *//** Key code constant: Clear key. */public static final int KEYCODE_CLEAR = 28; /** Key code constant: 'A' key. */public static final int KEYCODE_A = 29;/** Key code constant: 'B' key. */public static final int KEYCODE_B = 30;/** Key code constant: 'C' key. */public static final int KEYCODE_C = 31;/** Key code constant: 'D' key. */public static final int KEYCODE_D = 32;/** Key code constant: 'E' key. */public static final int KEYCODE_E = 33;/** Key code constant: 'F' key. */public static final int KEYCODE_F = 34;/** Key code constant: 'G' key. */public static final int KEYCODE_G = 35;/** Key code constant: 'H' key. */public static final int KEYCODE_H = 36;/** Key code constant: 'I' key. */public static final int KEYCODE_I = 37;/** Key code constant: 'J' key. */public static final int KEYCODE_J = 38;/** Key code constant: 'K' key. */public static final int KEYCODE_K = 39;/** Key code constant: 'L' key. */public static final int KEYCODE_L = 40;/** Key code constant: 'M' key. */public static final int KEYCODE_M = 41;/** Key code constant: 'N' key. */public static final int KEYCODE_N = 42;/** Key code constant: 'O' key. */public static final int KEYCODE_O = 43;/** Key code constant: 'P' key. */public static final int KEYCODE_P = 44;/** Key code constant: 'Q' key. */public static final int KEYCODE_Q = 45;/** Key code constant: 'R' key. */public static final int KEYCODE_R = 46;/** Key code constant: 'S' key. */public static final int KEYCODE_S = 47;/** Key code constant: 'T' key. */public static final int KEYCODE_T = 48;/** Key code constant: 'U' key. */public static final int KEYCODE_U = 49;/** Key code constant: 'V' key. */public static final int KEYCODE_V = 50;/** Key code constant: 'W' key. */public static final int KEYCODE_W = 51;/** Key code constant: 'X' key. */public static final int KEYCODE_X = 52;/** Key code constant: 'Y' key. */public static final int KEYCODE_Y = 53;/** Key code constant: 'Z' key. */public static final int KEYCODE_Z = 54;/** Key code constant: ',' key. */public static final int KEYCODE_COMMA = 55; /** Key code constant: '.' key. */public static final int KEYCODE_PERIOD = 56; /** Key code constant: Left Alt modifier key. */public static final int KEYCODE_ALT_LEFT = 57; /** Key code constant: Right Alt modifier key. */public static final int KEYCODE_ALT_RIGHT = 58; /** Key code constant: Left Shift modifier key. */ public static final int KEYCODE_SHIFT_LEFT = 59; /** Key code constant: Right Shift modifier key. */ public static final int KEYCODE_SHIFT_RIGHT = 60; /** Key code constant: Tab key. */public static final int KEYCODE_TAB = 61;/** Key code constant: Space key. */public static final int KEYCODE_SPACE = 62; /** Key code constant: Symbol modifier key.* Used to enter alternate symbols. */public static final int KEYCODE_SYM = 63;/** Key code constant: Explorer special function key.* Used to launch a browser application. */public static final int KEYCODE_EXPLORER = 64; /** Key code constant: Envelope special function key. * Used to launch a mail application. */public static final int KEYCODE_ENVELOPE = 65; /** Key code constant: Enter key. *//** Key code constant: '`' (backtick) key. */public static final int KEYCODE_GRAVE = 68;/** Key code constant: '-'. */public static final int KEYCODE_MINUS = 69;/** Key code constant: '=' key. */public static final int KEYCODE_EQUALS = 70;/** Key code constant: '[' key. */public static final int KEYCODE_LEFT_BRACKET = 71;/** Key code constant: ']' key. */public static final int KEYCODE_RIGHT_BRACKET = 72;/** Key code constant: '\' key. */public static final int KEYCODE_BACKSLASH = 73;/** Key code constant: ';' key. */public static final int KEYCODE_SEMICOLON = 74;/** Key code constant: ''' (apostrophe) key. */public static final int KEYCODE_APOSTROPHE = 75;/** Key code constant: '/' key. */public static final int KEYCODE_SLASH = 76;/** Key code constant: '@' key. */public static final int KEYCODE_AT = 77;/** Key code constant: Number modifier key.* Used to enter numeric symbols.* This key is not Num Lock; it is more like {@link #KEYCODE_ALT_LEFT} and is* interpreted as an ALT key by {@link android.text.method.MetaKeyKeyListener}. */public static final int KEYCODE_NUM = 78;/** Key code constant: Headset Hook key.* Used to hang up calls and stop media. */public static final int KEYCODE_HEADSETHOOK = 79;/** Key code constant: Camera Focus key.* Used to focus the camera. */public static final int KEYCODE_FOCUS = 80; // *Camera* focus/** Key code constant: '+' key. */public static final int KEYCODE_PLUS = 81;/** Key code constant: Menu key. */public static final int KEYCODE_MENU = 82;/** Key code constant: Notification key. */public static final int KEYCODE_NOTIFICATION = 83;/** Key code constant: Search key. */public static final int KEYCODE_SEARCH = 84;/** Key code constant: Play/Pause media key. */public static final int KEYCODE_MEDIA_PLAY_PAUSE= 85;/** Key code constant: Stop media key. */public static final int KEYCODE_MEDIA_STOP = 86;/** Key code constant: Play Next media key. */public static final int KEYCODE_MEDIA_NEXT = 87;/** Key code constant: Play Previous media key. */public static final int KEYCODE_MEDIA_PREVIOUS = 88;/** Key code constant: Rewind media key. */public static final int KEYCODE_MEDIA_REWIND = 89;/** Key code constant: Fast Forward media key. */public static final int KEYCODE_MEDIA_FAST_FORWARD = 90;/** Key code constant: Mute key.* Mutes the microphone, unlike {@link #KEYCODE_VOLUME_MUTE}. */public static final int KEYCODE_MUTE = 91;/** Key code constant: Page Up key. */public static final int KEYCODE_PAGE_UP = 92;/** Key code constant: Page Down key. */public static final int KEYCODE_PAGE_DOWN = 93;/** Key code constant: Picture Symbols modifier key.* Used to switch symbol sets (Emoji, Kao-moji). */public static final int KEYCODE_PICTSYMBOLS = 94; // switch symbol-sets (Emoji,Kao-moji) /** Key code constant: Switch Charset modifier key.* Used to switch character sets (Kanji, Katakana). */public static final int KEYCODE_SWITCH_CHARSET = 95; // switch char-sets (Kanji,Katakana) /** Key code constant: A Button key.* On a game controller, the A button should be either the button labeled A* or the first button on the bottom row of controller buttons. */public static final int KEYCODE_BUTTON_A = 96;/** Key code constant: B Button key.* On a game controller, the B button should be either the button labeled B* or the second button on the bottom row of controller buttons. */public static final int KEYCODE_BUTTON_B = 97;/** Key code constant: C Button key.* On a game controller, the C button should be either the button labeled C* or the third button on the bottom row of controller buttons. */public static final int KEYCODE_BUTTON_C = 98;/** Key code constant: X Button key.* On a game controller, the X button should be either the button labeled X* or the first button on the upper row of controller buttons. *//** Key code constant: Z Button key.* On a game controller, the Z button should be either the button labeled Z* or the third button on the upper row of controller buttons. */public static final int KEYCODE_BUTTON_Z = 101;/** Key code constant: L1 Button key.* On a game controller, the L1 button should be either the button labeled L1 (or L)* or the top left trigger button. */public static final int KEYCODE_BUTTON_L1 = 102;/** Key code constant: R1 Button key.* On a game controller, the R1 button should be either the button labeled R1 (or R)* or the top right trigger button. */public static final int KEYCODE_BUTTON_R1 = 103;/** Key code constant: L2 Button key.* On a game controller, the L2 button should be either the button labeled L2* or the bottom left trigger button. */public static final int KEYCODE_BUTTON_L2 = 104;/** Key code constant: R2 Button key.* On a game controller, the R2 button should be either the button labeled R2* or the bottom right trigger button. */public static final int KEYCODE_BUTTON_R2 = 105;/** Key code constant: Left Thumb Button key.* On a game controller, the left thumb button indicates that the left (or only)* joystick is pressed. */public static final int KEYCODE_BUTTON_THUMBL = 106;/** Key code constant: Right Thumb Button key.* On a game controller, the right thumb button indicates that the right* joystick is pressed. */public static final int KEYCODE_BUTTON_THUMBR = 107;/** Key code constant: Start Button key.* On a game controller, the button labeled Start. */public static final int KEYCODE_BUTTON_START = 108;/** Key code constant: Select Button key.* On a game controller, the button labeled Select. */public static final int KEYCODE_BUTTON_SELECT = 109;/** Key code constant: Mode Button key.* On a game controller, the button labeled Mode. */public static final int KEYCODE_BUTTON_MODE = 110;/** Key code constant: Escape key. */public static final int KEYCODE_ESCAPE = 111;/** Key code constant: Forward Delete key.* Deletes characters ahead of the insertion point, unlike {@link #KEYCODE_DEL}. */ public static final int KEYCODE_FORWARD_DEL = 112;/** Key code constant: Left Control modifier key. */public static final int KEYCODE_CTRL_LEFT = 113;/** Key code constant: Right Control modifier key. */public static final int KEYCODE_CTRL_RIGHT = 114;/** Key code constant: Caps Lock key. */public static final int KEYCODE_CAPS_LOCK = 115;/** Key code constant: Scroll Lock key. */public static final int KEYCODE_SCROLL_LOCK = 116;/** Key code constant: Left Meta modifier key. */public static final int KEYCODE_META_LEFT = 117;/** Key code constant: Right Meta modifier key. */public static final int KEYCODE_META_RIGHT = 118;/** Key code constant: Function modifier key. */public static final int KEYCODE_FUNCTION = 119;/** Key code constant: System Request / Print Screen key. */public static final int KEYCODE_SYSRQ = 120;/** Key code constant: Break / Pause key. */public static final int KEYCODE_BREAK = 121;/** Key code constant: Home Movement key.* Used for scrolling or moving the cursor around to the start of a line* or to the top of a list. */public static final int KEYCODE_MOVE_HOME = 122;/** Key code constant: End Movement key.* Used for scrolling or moving the cursor around to the end of a line* or to the bottom of a list. */public static final int KEYCODE_MOVE_END = 123;/** Key code constant: Insert key.* Toggles insert / overwrite edit mode. */public static final int KEYCODE_INSERT = 124;/** Key code constant: Forward key.* Navigates forward in the history stack. Complement of {@link #KEYCODE_BACK}. */ public static final int KEYCODE_FORWARD = 125;/** Key code constant: Play media key. */public static final int KEYCODE_MEDIA_PLAY = 126;/** Key code constant: Pause media key. */public static final int KEYCODE_MEDIA_PAUSE = 127;/** Key code constant: Close media key./** Key code constant: Record media key. */public static final int KEYCODE_MEDIA_RECORD = 130;/** Key code constant: F1 key. */public static final int KEYCODE_F1 = 131;/** Key code constant: F2 key. */public static final int KEYCODE_F2 = 132;/** Key code constant: F3 key. */public static final int KEYCODE_F3 = 133;/** Key code constant: F4 key. */public static final int KEYCODE_F4 = 134;/** Key code constant: F5 key. */public static final int KEYCODE_F5 = 135;/** Key code constant: F6 key. */public static final int KEYCODE_F6 = 136;/** Key code constant: F7 key. */public static final int KEYCODE_F7 = 137;/** Key code constant: F8 key. */public static final int KEYCODE_F8 = 138;/** Key code constant: F9 key. */public static final int KEYCODE_F9 = 139;/** Key code constant: F10 key. */public static final int KEYCODE_F10 = 140;/** Key code constant: F11 key. */public static final int KEYCODE_F11 = 141;/** Key code constant: F12 key. */public static final int KEYCODE_F12 = 142;/** Key code constant: Num Lock key.* This is the Num Lock key; it is different from {@link #KEYCODE_NUM}.* This key alters the behavior of other keys on the numeric keypad. */public static final int KEYCODE_NUM_LOCK = 143;/** Key code constant: Numeric keypad '0' key. */public static final int KEYCODE_NUMPAD_0 = 144;/** Key code constant: Numeric keypad '1' key. */public static final int KEYCODE_NUMPAD_1 = 145;/** Key code constant: Numeric keypad '2' key. */public static final int KEYCODE_NUMPAD_2 = 146;/** Key code constant: Numeric keypad '3' key. */public static final int KEYCODE_NUMPAD_3 = 147;/** Key code constant: Numeric keypad '4' key. */public static final int KEYCODE_NUMPAD_4 = 148;/** Key code constant: Numeric keypad '5' key. */public static final int KEYCODE_NUMPAD_5 = 149;/** Key code constant: Numeric keypad '6' key. */public static final int KEYCODE_NUMPAD_6 = 150;/** Key code constant: Numeric keypad '7' key. */public static final int KEYCODE_NUMPAD_7 = 151;/** Key code constant: Numeric keypad '8' key. */public static final int KEYCODE_NUMPAD_8 = 152;/** Key code constant: Numeric keypad '9' key. */public static final int KEYCODE_NUMPAD_9 = 153;/** Key code constant: Numeric keypad '/' key (for division). */public static final int KEYCODE_NUMPAD_DIVIDE = 154;/** Key code constant: Numeric keypad '*' key (for multiplication). */public static final int KEYCODE_NUMPAD_MULTIPLY = 155;/** Key code constant: Numeric keypad '-' key (for subtraction). */public static final int KEYCODE_NUMPAD_SUBTRACT = 156;/** Key code constant: Numeric keypad '+' key (for addition). */public static final int KEYCODE_NUMPAD_ADD = 157;/** Key code constant: Numeric keypad '.' key (for decimals or digit grouping). */ public static final int KEYCODE_NUMPAD_DOT = 158;/** Key code constant: Numeric keypad ',' key (for decimals or digit grouping). */ public static final int KEYCODE_NUMPAD_COMMA = 159;/** Key code constant: Numeric keypad Enter key. */public static final int KEYCODE_NUMPAD_ENTER = 160;/** Key code constant: Numeric keypad '=' key. */public static final int KEYCODE_NUMPAD_EQUALS = 161;/** Key code constant: Numeric keypad '(' key. */public static final int KEYCODE_NUMPAD_LEFT_PAREN = 162;/** Key code constant: Numeric keypad ')' key. */public static final int KEYCODE_NUMPAD_RIGHT_PAREN = 163;/** Key code constant: Volume Mute key.* Mutes the speaker, unlike {@link #KEYCODE_MUTE}.* This key should normally be implemented as a toggle such that the first press * mutes the speaker and the second press restores the original volume. */ public static final int KEYCODE_VOLUME_MUTE = 164;/** Key code constant: Info key.* Common on TV remotes to show additional information related to what is* currently being viewed. */public static final int KEYCODE_INFO = 165;/** Key code constant: Zoom in key. */public static final int KEYCODE_ZOOM_IN = 168;/** Key code constant: Zoom out key. */public static final int KEYCODE_ZOOM_OUT = 169;/** Key code constant: TV key.* On TV remotes, switches to viewing live TV. */public static final int KEYCODE_TV = 170;/** Key code constant: Window key.* On TV remotes, toggles picture-in-picture mode or other windowing functions. */ public static final int KEYCODE_WINDOW = 171;/** Key code constant: Guide key.* On TV remotes, shows a programming guide. */public static final int KEYCODE_GUIDE = 172;/** Key code constant: DVR key.* On some TV remotes, switches to a DVR mode for recorded shows. */public static final int KEYCODE_DVR = 173;/** Key code constant: Bookmark key.* On some TV remotes, bookmarks content or web pages. */public static final int KEYCODE_BOOKMARK = 174;/** Key code constant: Toggle captions key.* Switches the mode for closed-captioning text, for example during television shows. */ public static final int KEYCODE_CAPTIONS = 175;/** Key code constant: Settings key.* Starts the system settings activity. */public static final int KEYCODE_SETTINGS = 176;/** Key code constant: TV power key.* On TV remotes, toggles the power on a television screen. */public static final int KEYCODE_TV_POWER = 177;/** Key code constant: TV input key.* On TV remotes, switches the input on a television screen. */public static final int KEYCODE_TV_INPUT = 178;/** Key code constant: Set-top-box power key.* On TV remotes, toggles the power on an external Set-top-box. */public static final int KEYCODE_STB_POWER = 179;/** Key code constant: Set-top-box input key.* On TV remotes, switches the input mode on an external Set-top-box. */public static final int KEYCODE_STB_INPUT = 180;/** Key code constant: A/V Receiver power key.* On TV remotes, toggles the power on an external A/V Receiver. */public static final int KEYCODE_AVR_POWER = 181;/** Key code constant: A/V Receiver input key.* On TV remotes, switches the input mode on an external A/V Receiver. */public static final int KEYCODE_AVR_INPUT = 182;/** Key code constant: Red "programmable" key.* On TV remotes, acts as a contextual/programmable key. */public static final int KEYCODE_PROG_RED = 183;/** Key code constant: Green "programmable" key.* On TV remotes, actsas a contextual/programmable key. */public static final int KEYCODE_PROG_GREEN = 184;/** Key code constant: Yellow "programmable" key.* On TV remotes, acts as a contextual/programmable key. */public static final int KEYCODE_PROG_YELLOW = 185;/** Key code constant: Blue "programmable" key.* On TV remotes, acts as a contextual/programmable key. */public static final int KEYCODE_PROG_BLUE = 186;/** Key code constant: App switch key.* Should bring up the application switcher dialog. */public static final int KEYCODE_APP_SWITCH = 187;/** Key code constant: Generic Game Pad Button #1.*/public static final int KEYCODE_BUTTON_1 = 188;/** Key code constant: Generic Game Pad Button #2.*/public static final int KEYCODE_BUTTON_2 = 189;/** Key code constant: Generic Game Pad Button #3.*/public static final int KEYCODE_BUTTON_3 = 190;/** Key code constant: Generic Game Pad Button #4.*/public static final int KEYCODE_BUTTON_4 = 191;/** Key code constant: Generic Game Pad Button #5.*/public static final int KEYCODE_BUTTON_5 = 192;/** Key code constant: Generic Game Pad Button #6.*/public static final int KEYCODE_BUTTON_6 = 193;/** Key code constant: Generic Game Pad Button #7.*/public static final int KEYCODE_BUTTON_7 = 194;/** Key code constant: Generic Game Pad Button #8.*/public static final int KEYCODE_BUTTON_8 = 195;/** Key code constant: Generic Game Pad Button #9.*/public static final int KEYCODE_BUTTON_9 = 196;/** Key code constant: Generic Game Pad Button #10.*/public static final int KEYCODE_BUTTON_10 = 197;/** Key code constant: Generic Game Pad Button #14.*/public static final int KEYCODE_BUTTON_14 = 201;/** Key code constant: Generic Game Pad Button #15.*/public static final int KEYCODE_BUTTON_15 = 202;/** Key code constant: Generic Game Pad Button #16.*/public static final int KEYCODE_BUTTON_16 = 203;/** Key code constant: Language Switch key.* Toggles the current input language such as switching between English and Japanese on * a QWERTY keyboard. On some devices, the same function may be performed by* pressing Shift+Spacebar. */public static final int KEYCODE_LANGUAGE_SWITCH = 204;/** Key code constant: Manner Mode key.* Toggles silent or vibrate mode on and off to make the device behave more politely* in certain settings such as on a crowded train. On some devices, the key may only* operate when long-pressed. */public static final int KEYCODE_MANNER_MODE = 205;/** Key code constant: 3D Mode key.* Toggles the display between 2D and 3D mode. */public static final int KEYCODE_3D_MODE = 206;/** Key code constant: Contacts special function key.* Used to launch an address book application. */public static final int KEYCODE_CONTACTS = 207;/** Key code constant: Calendar special function key.* Used to launch a calendar application. */public static final int KEYCODE_CALENDAR = 208;/** Key code constant: Music special function key.* Used to launch a music player application. */public static final int KEYCODE_MUSIC = 209;/** Key code constant: Calculator special function key.* Used to launch a calculator application. */public static final int KEYCODE_CALCULATOR = 210;/** Key code constant: Japanese full-width / half-width key. */public static final int KEYCODE_ZENKAKU_HANKAKU = 211;/** Key code constant: Japanese alphanumeric key. */public static final int KEYCODE_EISU = 212;/** Key code constant: Japanese non-conversion key. */public static final int KEYCODE_MUHENKAN = 213;/** Key code constant: Japanese conversion key. */public static final int KEYCODE_HENKAN = 214;/** Key code constant: Japanese katakana / hiragana key. */public static final int KEYCODE_KATAKANA_HIRAGANA = 215;/** Key code constant: Japanese Yen key. */public static final int KEYCODE_YEN = 216;/** Key code constant: Japanese Ro key. */public static final int KEYCODE_RO = 217;/** Key code constant: Japanese kana key. */public static final int KEYCODE_KANA = 218;/** Key code constant: Assist key.* Launches the global assist activity. Not delivered to applications. */public static final int KEYCODE_ASSIST = 219;/** Key code constant: Brightness Down key.* Adjusts the screen brightness down. */public static final int KEYCODE_BRIGHTNESS_DOWN = 220;/** Key code constant: Brightness Up key.* Adjusts the screen brightness up. */public static final int KEYCODE_BRIGHTNESS_UP = 221;/** Key code constant: Audio Track key.* Switches the audio tracks. */public static final int KEYCODE_MEDIA_AUDIO_TRACK = 222;/** Key code constant: Sleep key.* Puts the device to sleep. Behaves somewhat like {@link #KEYCODE_POWER} but it * has no effect if the device is already asleep. */public static final int KEYCODE_SLEEP = 223;/** Key code constant: Wakeup key.* Wakes up the device. Behaves somewhat like {@link #KEYCODE_POWER} but it* has no effect if the device is already awake. */public static final int KEYCODE_WAKEUP = 224;/** Key code constant: Pairing key.* Initiates peripheral pairing mode. Useful for pairing remote control* devices or game controllers, especially if no other input mode is* available. */public static final int KEYCODE_PAIRING = 225;/** Key code constant: Media Top Menu key.* Goes to the top of media menu. */public static final int KEYCODE_MEDIA_TOP_MENU = 226;/** Key code constant: '11' key. */public static final int KEYCODE_11 = 227;/** Key code constant: '12' key. */* Displays data services like weather, sports. */public static final int KEYCODE_TV_DATA_SERVICE = 230;/** Key code constant: Voice Assist key.* Launches the global voice assist activity. Not delivered to applications. */public static final int KEYCODE_VOICE_ASSIST = 231;/** Key code constant: Radio key.* Toggles TV service / Radio service. */public static final int KEYCODE_TV_RADIO_SERVICE = 232;/** Key code constant: Teletext key.* Displays Teletext service. */public static final int KEYCODE_TV_TELETEXT = 233;/** Key code constant: Number entry key.* Initiates to enter multi-digit channel nubmber when each digit key is assigned* for selecting separate channel. Corresponds to Number Entry Mode (0x1D) of CEC * User Control Code. */public static final int KEYCODE_TV_NUMBER_ENTRY = 234;/** Key code constant: Analog Terrestrial key.* Switches to analog terrestrial broadcast service. */public static final int KEYCODE_TV_TERRESTRIAL_ANALOG = 235;/** Key code constant: Digital Terrestrial key.* Switches to digital terrestrial broadcast service. */public static final int KEYCODE_TV_TERRESTRIAL_DIGITAL = 236;/** Key code constant: Satellite key.* Switches to digital satellite broadcast service. */public static final int KEYCODE_TV_SATELLITE = 237;/** Key code constant: BS key.* Switches to BS digital satellite broadcasting service available in Japan. */public static final int KEYCODE_TV_SATELLITE_BS = 238;/** Key code constant: CS key.* Switches to CS digital satellite broadcasting service available in Japan. */public static final int KEYCODE_TV_SATELLITE_CS = 239;/** Key code constant: BS/CS key.* Toggles between BS and CS digital satellite services. */public static final int KEYCODE_TV_SATELLITE_SERVICE = 240;/** Key code constant: Toggle Network key.* Toggles selecting broacast services. */public static final int KEYCODE_TV_NETWORK = 241;/** Key code constant: Antenna/Cable key.* Toggles broadcast input source between antenna and cable. */public static final int KEYCODE_TV_ANTENNA_CABLE = 242;/** Key code constant: HDMI #1 key.* Switches to HDMI input #1. */public static final int KEYCODE_TV_INPUT_HDMI_1 = 243;/** Key code constant: HDMI #2 key.* Switches to HDMI input #2. */public static final int KEYCODE_TV_INPUT_HDMI_2 = 244;/** Key code constant: HDMI #3 key.* Switches to HDMI input #3. */public static final int KEYCODE_TV_INPUT_HDMI_3 = 245;/** Key code constant: HDMI #4 key.* Switches to HDMI input #4. */public static final int KEYCODE_TV_INPUT_HDMI_4 = 246;/** Key code constant: Composite #1 key.* Switches to composite video input #1. */public static final int KEYCODE_TV_INPUT_COMPOSITE_1 = 247;/** Key code constant: Composite #2 key.* Switches to composite video input #2. */public static final int KEYCODE_TV_INPUT_COMPOSITE_2 = 248;/** Key code constant: Component #1 key.* Switches to component video input #1. */public static final int KEYCODE_TV_INPUT_COMPONENT_1 = 249;/** Key code constant: Component #2 key.* Switches to component video input #2. */public static final int KEYCODE_TV_INPUT_COMPONENT_2 = 250;/** Key code constant: VGA #1 key.* Switches to VGA (analog RGB) input #1. */public static final int KEYCODE_TV_INPUT_VGA_1 = 251;/** Key code constant: Audio description key.* Toggles audio description off / on. */public static final int KEYCODE_TV_AUDIO_DESCRIPTION = 252;/** Key code constant: Audio description mixing volume up key.* Louden audio description volume as compared with normal audio volume. */ public static final int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP = 253;/** Key code constant: Audio description mixing volume down key.* Lessen audio description volume as compared with normal audio volume. */ public static final int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN = 254;/** Key code constant: Zoom mode key.* Changes Zoom mode (Normal, Full, Zoom, Wide-zoom, etc.) */public static final int KEYCODE_TV_ZOOM_MODE = 255;。

ADB_shell教程

ADB教程写在前面 (1)1、什么是adb? (1)2、怎么获得? (1)3、怎么使用? (2)4、相关命令解释 (2)5、建议: (5)更新时间:2011年3月19日写在前面为什么写这篇文章?最主要的原因是很多人问我,什么是adb shell?怎么进入adb shell?而我由于工作的特殊性,实在没有那么多的时间一一答复,所以写了这篇文章给大家参考。

希望能够帮到大家。

其实使用Android手机,很简单,用就好。

如果要玩,那么首先要明白android 是一个开源操作系统,并基于linux开源操作系统,Android继承了Linux的特性。

其实你可以把自己的手机看做一台计算机,只是个头很小,能打电话。

现在开始正文:1、什么是adb?adb的全称为Android Debug Bridge,是一个调试工具。

借助它,开发人员可以完成很多需要再手机端操作所需完成的事情。

而我们,则可以利用它完成一些我们想要完成的事。

2、怎么获得?Linux下不再累述。

(Ubuntu10.1064bit不知道为啥,就是不认我的U8500,我也没有好的经验可以介绍。

)Windows下,只需要将adb.exe AdbWinApi.dll AdbWinUsbApi.dll三个文件放入c:\windows\system32下即可。

三个文件可在附件中得到。

3、怎么使用?手机端:在设置--应用程序---开发---USB调试后打钩Windows下开始---运行---输入“cmd”--回车进入cmd命令行下。

这时候可以输入adb,返回如下图(我真的不知道怎么描述这些了。

大家看图吧,稍微懂点英语还是好的。

),则表示你可以运行相关的adb命令了。

4、相关命令解释Adb的附带命令很多的。

对于我们这些手机玩家来说,需要会用的只是下面几个(在上面的命令行下输入):(1)Adb shell直接进入adb shell模式例子:在adb shell中我们可以做很多事情。

adbshell常用命令(一)

adbshell常用命令(一)adb shell 里面有许多有用的命令可以帮助我们对android模拟器或设备进行操作首先进入adb shellC:\Users uxu>adb shellroot@xumin:/ #(一)基本的linux命令1.ls列出当前目录下的文件夹和文件,可以用ls -l或直接ll列出详细内容root@xumin:/ # lllldrwxr-xr-x root root 1970-01-28 13:48 acctdrwxrwx--- system cache 1970-01-28 08:03 cache -rwxr-x--- root root 268456 1970-01-01 08:00 charger dr-x------ root root 1970-01-28 13:48 configlrwxrwxrwx root root 1970-01-28 13:48 d -> /sys/kernel/debugdrwxrwx--x system system 2014-06-08 12:25 data2.pwd打印出当前所在的目录路径,在写脚本的时候会有用root@xumin:/system/app # pwdpwd/system/app3.cd切换目录"cd -" 切换到上次目录"cd .." 切换到上级目录"cd ../.."切换到上级的上级目录目录名较长时建议使用通配符"*",如cd到system目录:root@xumin:/ # cd sy*mcd sy*mroot@xumin:/system #4.cp复制文件,如复制当前目录下的xumin-song.mp3到当前目录下的tmp目录下:root@xumin:/storage/sdcard0 # cp xumin-song.mp3 ./tmp cp xumin-song.mp3 ./tmproot@xumin:/storage/sdcard0 # cd tmpcd tmproot@xumin:/storage/sdcard0/tmp # lslsxumin-song.mp35.mv移动文件或者文件夹,重命名。

详解adbshell常用命令

详解adbshell常⽤命令⼀、⽂件操作相关命令1.⽂件操作命令⼦命令参数说明cd⽆进⼊⽬录cat[-beflnstuv] [-B bsize] [file...]查看⽂件内容-n:显⽰⾏号-b:显⽰⾏号,但会忽略空⾏-s:显⽰⾏号,连续空⾏标记为⼀⾏df⽆列出分区列表du[-H] [-L] [-P] [-a] [-d depth] [-s] [-cghikmnrx] [file...]查询⽂件或⽬录的磁盘使⽤空间ls[-a] [-i] [-l] [-n] [-s]列出⽬录内容-a:列出所有⽂件,包括隐藏⽂件-i:输出⽂件的i节点的索引信息-l列出⽂件的详细信息-n:⽤数字的GUID代替名称-s:输出该⽂件的⼤⼩grep [-abcDEFGHhliJLlmnOoPqRSsUVvwxZz][-A num][-B num][-C[num][-e pattern][-f file][--binary-files=value][--color=when][--context=num][--directories=action][--lable][--line-buffered][pattern] [file...]指定⽂件中搜索特定的内容,并将含有这些内容的⾏标准输出mkdir-p,-parents创建⽬录-p,--parents:递归创建⽬录touch touch [-alm] [-t YYYYMMDD [.HHMMSS]] < file >创建⽂件rm rm [-f\|-i][-dPRrvWx]file 删除⽂件-f:强制删除⽂件,系统不提⽰-i:交互式删除,删除前提⽰-d:改变硬连接数据删成0,删除该⽂件-r:强制删除⽂件夹包括⾥⾯的⽂件mv mv[-fiv]source target 移动⽂件(相当于剪切)-f:强制移动,若⽂件已经存在⽬标则直接覆盖-i:若⽬标⽂件已经存在,会询问是否覆盖rmdir rmdir[-p] directory删除⽬录-p:递归删除⽬录,只能删除空⽬录dd dd[operand...]dd if =source of=targe复制⽂件2.⽂件权限命令与其他⽂件命令⼦命令参数说明chomd chomd[OPTION]< MODE > < FILE>⽂件权限修改-R:递归改变⽂件和⽬录-h:不遵循符号连接chown chown[-R[-H\|-L\|-P]] [-fhv]owner : group | owner | : group file更改某个⽂件或⽬录的属主和属组md5md5 file...查询⽂件的MD5值mount mount [-r] [-w] [-o options] [-t type]挂载设备信息umount卸载分区挂载cmp要指出两个⽂件是否存在差异ln⽤来在⽂件之间创建连接,创建连接后两个⽂件中任意⼀个⽂件改变⽂件内容另⼀⽂件都会相应进⾏同步改变3.命令使⽤实例://进⼊设备adb shell//进⼊指定⽬录"/data/local/tmp"cd /data/local/tmp//查看⽬录ls//进⼊根⽬录cd ///进⼊指定⽬录"/data/local/tmp"cd /data/local/tmp//查看分区列表df//在当前⽬录下创建名为1的.txt⽂件(再创建个两个,命名为2和3,⽅便后⾯继续学习使⽤)touch 1.txt//列出所有⽂件(包括隐藏⽂件)的详细信息,此时可以查看刚刚的1.txt是否创建成功ls -al//在当前⽬录下创建⼀个名为1的⽂件夹mkdir1//列出所有⽂件(包括隐藏⽂件)的详细信息,此时可以查看刚刚的⽬录⽂件夹是否创建成功ls -al//在当前⽬录下创建递归⽬录,2下⾯包含3,3下⾯包含4mkdir -p 2/3/4//回到上⼀级⽬录,连续操作两次让他回到cd /data/local/tmp⽬录下cd ..//将1.txt⽂件移动到1⽬录中(剪切效果)mv 1.txt 1//进⼊1⽬录cd 1//查看1.txt是否移动进去了ls//返回上⼀级⽬录cd ..//将当前⽬录下的2.txt⽂件复制到名为2的⽬录下并命名为2.txtdd if=2.txtof=2/22.txt//进⼊到⽬录2中cd 2//查看上个⽂件操作是否操作成功ls//回到上⼀级⽬录cd ..//进⼊1⽬录cd 1//删除当前⽬录下的1.txt⽂件rm 1.txt//回到上⼀级⽬cd ..//删除名为1的⽬录rmdir 1//查看删除操作是否删除成功ls//查看⽂件权限信息la -al//修改2.txt的⽂件权限为最⾼chomd 777 2.txt//查看刚刚修改的⽂件权限信息是否成功la -al//查看2.txt⽂件的md5md5 2.txt//查看挂载设备信息mount//将system分区变成可读可写"mount -o [option] devices directory"mount -o remount,rw /dev/block/sda6 /system//查看刚刚的修改是否成功mount//查看分区列表df//卸载掉"/storage/sdcard"分区挂载umount /storage/sdcard//查看刚刚的卸载是否成功df//输⼊点内容到2.txt中echo 333 >>2.txtecho 222 >>2.txt//查看2.txt⽂件cat 2.txt//指出两个⽂件是否存在差异cmp 2.txt 3.txt//复制2.txt⽂件夹并粘贴到当前⽬录中,命名为22.txtdd if=2.txt of=22.txt//指出两个⽂件是否存在差异cmp 2.txt 3.txtcd//在2⽬录下创建⼀个名为2o.txt的2的硬连接⽂件(因为2的⽬录下已经存在2.txt⽂件,不然使⽤"ln 2.txt 2"命令就可以了)ln 2.txt 2/2o.txt//进⼊到2⽬录cd 2//查看2o.txt⽂件内容cat 2o.txt//在2o.txt⽂件中加⼊内容echo >>2o.txt//返回上⼀级⽬录cd ..//查看连接⽂件2.txt的⽂件内容是否与2o.txt⼀致cat 2.txt⼆、信息查询相关命令1.log 相关命令⼦命令参数说明dumpstate-系统状态信息(需要root权限)包括⼿机当前的内存信息、CPU信息、logcat缓存,kenel缓存等等adb bugreport包含这个信息bugreport-⾥⾯含有dmesg,dumpstate和dumpsysy demsg-kenel的loglogcat参数较多打印⽇志缓冲区⽇志dumpsys meminfo [processName]activity [processName]获取系统各项服务信息2.获取系统信息相关命令⼦命令参数说明getevent-获取按键信息getprop-获取系统属性setprop-设置系统属性(需要root权限)pm-安装包管理,查询安装包的各种信息ps-查看进程信息top -m num 最⼤显⽰条数-n num 更新次数-d num 两者更新时间-s col按哪列排序(cpu,vss,rss,thr)-t显⽰线程信息⽽不是进程-h显⽰帮助⽂档获取CPU使⽤情况procrank-查询各进⾏内存消耗情况(需要root权限)wm size获取屏幕分辨率3.命令使⽤实例//输出系统状态信息⾄F:\test\dumpstate.txt,由于需要root权限,所以没root的过的⼿机输出为空adb shell dumptate >F:\test\dumpstate.txt//输出过去系统的状态,log,⼀般操作过程中未抓取log的时候⼀旦出现问题就使⽤这个命令来查看adb shell bugreport >F:\test\bugreport.txt//输出内核信息adb shell dmesg//输出当前缓冲区⽇志并保存adb shell logcat >F:\test\bugreport.txt//输出内存信息adb shell dumpsys meminfo//输出当前CPU使⽤情况信息adb shell dumpsys cpuinfo//输出当前activity使⽤情况信息adb shell dumpsys activity//相当于过滤,只找名为"mF"的activity使⽤情况信息adb shell dumpsys activity | find "mF"//获取按键信息,在⼿机没有按键信息的情况下会先提⽰你每个设备的ID代表的设备信息,按键过程中会实时刷新adb shell getevent//获取系统属性adb shell getprop//查看pm帮助信息adb shell pm//查看⼿机内的安装包列表adb shell pm list packages//查看当前⼿机进程信息adb shell ps//获取cpu使⽤情况,只查看⼀次,不实时刷新adb shell top -n 1//获取前⼗的cpu使⽤情况,只查看⼀次,不实时刷新adb shell top -n 1 -m 10//查询各进⾏内存消耗情况adb shell procrank//详细查询某个包的内存使⽤情况adb shell dumpsys meminfo packageName三、操作⼿机相关命令1.相关命令⼦命令参数说明bmgr [backup | restore | list | transport | run]bmgr backup PACKAGEbmgr restore......数据备份与还原kill kill [-s signame | -signu | -signame]{job | pid | pgrp}...kill -l [exit_status...]结束进程reboot⽆重启⼿机svc power 控制电源管理data 控制数据连接控制wifi管理控制USB状态控制电源、⽹络、USBwipe wipe system | data | all擦除分区,恢复出⼚设置am am [subcommand] [options]am start......antivyty管理器⽤于开启应⽤,⼴播,服务等功能2.命令使⽤实例//查询已安装包名列表adb shell pm list package//对com.tencent.mm包使⽤monkey命令adb shell monkey -p com.tencent.mm --throttle 200 50000 //查找monkey进程信息adb shell ps | find "monkey"//杀掉monkey进程,例⼦中的数字是monkey的PID进程号adb shell kill 23770//重启⼿机adb shell reboot//打开svc帮助界⾯adb shell svc//查询wifi操作帮助adb shell svc wifi//关闭wifiadb shell svc wifi disable//打开wifiadb shell svc wifi enable//擦除data,即恢复出⼚设置adb shell wipe data//指定查询"mF"的activity信息adb shell dumpsys activity | find "mF"//启动指定activityadb shell am start -n com.android.browser/.BrowserActivyty//查看am命令的帮助信息adb shell am四、测试⽤途相关命令1.测试信息相关命令⼦命令参数说明iftop iftop [-r repeats] [-d delay]列出⽹络传输包情况Monkey Monkey [options] count执⾏Monkey命令netstat-显⽰各种⽹络相关信息ping ping [option] ipv4因特⽹包探测器,⽤于测试⽹络连接量的程序ping6ping6 [option] ipv6因特⽹包探测器,⽤于测试⽹络连接量的程序screenrecord screenrecord [options] < filename >屏幕录像(只⽀持android4.4以上的设备)screencap [-hp] [-d display-id] [FILENAME]-p ⽂件保存路径屏幕截图uiautomator uiautomator [options]执⾏uiautomator脚本命令使⽤实例://进⼊交互模式adb shell//列出⽹络传输包情况iftop//显⽰各种⽹络相关信息netstat//实时查看⽹络连接量ping //实时查看⽹络连接量ping6 //屏幕录像,保存路径为/mnt/sdcard/1.mp4,需要注意的是屏幕录像只⽀持android4.4以上的设备使⽤ctrl+c停⽌录像screenrecord /mnt/sdcard/1.mp4//将sd卡路径下的1.mp4导出到F盘(先退出交互模式)adb pull /mnt/sdcard/1.mp4 f:\//截图screencap /mnt/sdcard/1.png2.输⼊信息命令1)input作⽤:模拟硬件设备的输⼊格式:input [] [...]参数:test(Defalt;touchscreen)keyevent [--longpress] ...(Default:keyboard)tap (Default:touchscreen)swipe [duration(ms)] (Default:touchscreen)press (Default:trackball)roll (Default:trackball)2)命令使⽤实例//进⼊交互模式adb shell//输⼊⽂本123456input text 123456//使⽤keycode num输⼊,keycode表可百度查询input keyevent 7//使⽤keycode name输⼊1input keyevent KEYCODE_1//使⽤keycode name按空格键input keyevent KEYCODE_HOME//点击坐标367 1277input tap 367 1277//从(1024,945)滑动到(134,968)200毫秒内input swipe 1024 945 134 968 200到此这篇关于详解adb shell 常⽤命令的⽂章就介绍到这了,更多相关adb shell命令内容请搜索以前的⽂章或继续浏览下⾯的相关⽂章希望⼤家以后多多⽀持!。

adbshell命令详解

adbshell命令详解adb shell 命令详解进⼊命令⾏,使⽤1. adb shell进⼊到Android Shell命令模式,注意,这时候模拟器或者⼿机要启⽤并且正确接通。

在这个Android Shell命令环境中,可以:显⽰⽹络配置,⽹络配置可显⽰多个⽹络连接。

注意这多个⽹络连接:lo 是本地或 loopback 连接。

tiwlan0 是 WiFi 连接,该连接由本地 DHCP 服务器提供⼀个地址。

显⽰ PATH 环境变量的内容。

执⾏ su 命令,以成为超级⽤户。

将⽬录改为 /data/app,其中存放⽤户应⽤程序。

列出包含某个应⽤程序的⽬录。

Android 应⽤程序⽂件实际上是归档⽂件,可通过 WinZip 之类的软件查看。

扩展名为 apk。

发出 ping 命令,查看 是否可⽤。

从相同的命令提⽰符环境中,还可以与 SQLite 数据库交互,启动程序以及执⾏许多其他系统级任务。

想像⼀下您正在连接到电话,因此这是⾮常了不起的功能。

⼀、adb命令7. Java代码8. adb get-product // 获取设备的ID9. adb get-serialno // 获取设备的序列号10.adb devices // 得当前运⾏的模拟器/设备的实例的列表及每个实例的状态11.adb bugreport // 查看bug报告⼆、Android Shell命令通过adb shell命令进⼊shell后,执⾏下列命令。

1、访问数据库:12.sqlite32、记录⽆线通讯⽇志:⼀般来说,⽆线通讯的⽇志⾮常多,在运⾏时没必要去记录,但我们还是可以通过命令,设置记录:13.logcat -b radio3、删除应⽤:Android没有提供⼀个卸载应⽤的命令,需要⾃⼰⼿动删除:14.cd /data/app15.m appName.apk注:[appName]为应⽤的名称;三、可以在Android Shell命令下使⽤的⼀些linux命令命令:16.ls // 查看⽬录17.date // 打印或设置当前系统时间18.cat /proc/meminfo // 查看内存信息19.cat /proc/cpuinfo // 查看CPU信息Android Shell命令的相关内容就为⼤家介绍到这⾥。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档