Merge PR #442 (@ZackNeyland)

* pr-442:
  adb: attribute and update formatting
  Fixes date
  Adds cheatsheet for adb.
  HTTPS polyfill links
This commit is contained in:
Rico Sta. Cruz 2018-03-07 16:20:17 +08:00
commit 8c1317a2bc
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
2 changed files with 89 additions and 5 deletions

View File

@ -1,9 +1,9 @@
<script>(function(d,s){if(window.Promise&&[].includes&&Object.assign&&window.Map)return;var js,sc=d.getElementsByTagName(s)[0];js=d.createElement(s);js.src='https://cdn.polyfill.io/v2/polyfill.min.js';sc.parentNode.insertBefore(js, sc);}(document,'script'))</script> <script>(function(d,s){if(window.Promise&&[].includes&&Object.assign&&window.Map)return;var js,sc=d.getElementsByTagName(s)[0];js=d.createElement(s);js.src='https://cdn.polyfill.io/v2/polyfill.min.js';sc.parentNode.insertBefore(js, sc);}(document,'script'))</script>
<!--[if lt IE 9]>{%comment%} <!--[if lt IE 9]>{%comment%}
{%endcomment%}<script src='//cdnjs.cloudflare.com/ajax/libs/nwmatcher/1.2.5/nwmatcher.min.js'></script>{%comment%} {%endcomment%}<script src='https://cdnjs.cloudflare.com/ajax/libs/nwmatcher/1.2.5/nwmatcher.min.js'></script>{%comment%}
{%endcomment%}<script src='//cdnjs.cloudflare.com/ajax/libs/json2/20140204/json2.js'></script>{%comment%} {%endcomment%}<script src='https://cdnjs.cloudflare.com/ajax/libs/json2/20140204/json2.js'></script>{%comment%}
{%endcomment%}<script src='//cdn.rawgit.com/gisu/selectivizr/1.0.3/selectivizr.js'></script>{%comment%} {%endcomment%}<script src='https://cdn.rawgit.com/gisu/selectivizr/1.0.3/selectivizr.js'></script>{%comment%}
{%endcomment%}<script src='//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js'></script>{%comment%} {%endcomment%}<script src='https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js'></script>{%comment%}
{%endcomment%}<script src='//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js'></script>{%comment%} {%endcomment%}<script src='https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js'></script>{%comment%}
{%endcomment%}<![endif]--> {%endcomment%}<![endif]-->

84
adb.md Normal file
View File

@ -0,0 +1,84 @@
---
title: adb (Android Debug Bridge)
category: CLI
layout: 2017/sheet
weight: -1
authors:
- github: ZackNeyland
updated: 2018-03-06
---
### Device Basics
| Command | Description |
| --- | --- |
| `adb devices` | Lists connected devices |
| `adb devices -l` | Lists connected devices and kind |
| --- | --- |
| `adb root` | Restarts adbd with root permissions |
| `adb start-server` | Starts the adb server |
| `adb kill-server` | Kills the adb server |
| `adb remount` | Remounts file system with read/write access |
| `adb reboot` | Reboots the device |
| `adb reboot bootloader` | Reboots the device into fastboot |
| `adb disable-verity` | Reboots the device into fastboot |
`wait-for-device` can be specified after `adb` to ensure that the command will run once the device is connected.
`-s` can be used to send the commands to a specific device when multiple are connected.
#### Examples
```
$ adb wait-for-device devices
List of devices attached
somedevice-1234 device
someotherdevice-1234 device
```
```
$ adb -s somedevice-1234 root
```
### Logcat
| Command | Description |
| --- | --- |
| `adb logcat` | Starts printing log messages to stdout |
| `adb logcat -g` | Displays current log buffer sizes |
| `adb logcat -G <size>` | Sets the buffer size (K or M) |
| `adb logcat -c` | Clears the log buffers |
| `adb logcat *:V` | Enables ALL log messages (verbose) |
| `adb logcat -f <filename>` | Dumps to specified file |
#### Examples
```
$ adb logcat -G 16M
$ adb logcat *:V > output.log
```
### File Management
| Command | Description |
| --- | --- |
| `adb push <local> <remote>` | Copies the local to the device at remote |
| `adb pull <remote> <local>` | Copies the remote from the device to local |
#### Examples
```
$ echo "This is a test" > test.txt
$ adb push test.txt /sdcard/test.txt
$ adb pull /sdcard/test.txt pulledTest.txt
```
### Remote Shell
| Command | Description |
| --- | --- |
| `adb shell <command>` | Runs the specified command on device (most unix commands work here) |
| `adb shell wm size` | Displays the current screen resolution |
| `adb shell wm size WxH` | Sets the resolution to WxH |
| `adb shell pm list packages` | Lists all installed packages |
| `adb shell pm list packages -3` | Lists all installed 3rd-party packages |
| `adb shell monkey -p app.package.name` | Starts the specified package |