-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Android world | ||
|
||
- [adb snippets](adb-snippets.md) | ||
- [fastboot snippets](fastboot-snippets.md) | ||
- [emulator](emulator.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Android Debug Bridge (adb) snippets | ||
|
||
## Poweroff the phone | ||
|
||
```shell | ||
adb shell reboot -p | ||
``` | ||
|
||
## Kill the running ADB server | ||
|
||
```shell | ||
adb kill-server | ||
``` | ||
|
||
## List devices | ||
|
||
```shell | ||
adb devices | ||
``` | ||
|
||
## Run a command specifically for the running emulator or the connected physical device | ||
|
||
```shell | ||
adb -d <command> # command for device | ||
adb -e <command> # command for emulator | ||
adb -s <deviceid> # specify target | ||
# or just set an environment variable ANDROID_SERIAL='<deviceid>' | ||
``` | ||
|
||
## Shell commands | ||
|
||
### Open the shell | ||
|
||
```shell | ||
adb shell | ||
``` | ||
|
||
### (Un)Install an app | ||
|
||
```shell | ||
adb install file.apk | ||
adb uninstall com.app.www | ||
``` | ||
|
||
### Start (open) an app | ||
|
||
```shell | ||
adb shell monkey -p com.app.www 1 # starts main activity (opens the app, usually) | ||
``` | ||
|
||
## Wifi ADB | ||
|
||
```powershell | ||
# 192.168.1.34 is the LAN IP of the android device | ||
adb pair 192.168.1.34:38437 | ||
adb connect 192.168.1.34:35645 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Android Emulator | ||
|
||
References | ||
|
||
> - <https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels> | ||
> - <https://apilevels.com/> | ||
## Setup | ||
|
||
One time setup. | ||
In the examples, "Pixel4_api30_android11_x64" is the name of the emulator being created. | ||
In the examples, android api level 30 is used, which is android 11 (see references above). | ||
|
||
All commands are in Powershell syntax. | ||
|
||
### Install tools, platform, system image | ||
|
||
```Powershell | ||
sdkmanager platform-tools | ||
sdkmanager "build-tools;30.0.3" | ||
sdkmanager "platforms;android-30" | ||
sdkmanager "system-images;android-30;google_apis;x86_64" | ||
``` | ||
|
||
### Create emulator | ||
|
||
```powershell | ||
# avdmanager create avd -n <name> -k "system-images;android-<api level>;google_apis;x86_64" | ||
avdmanager create avd -n Pixel4_api30_android11_x64 -k "system-images;android-30;google_apis;x86_64" | ||
# check if all is well | ||
emulator -list-avds | ||
``` | ||
|
||
### `config.ini` useful settings | ||
|
||
Add the following settings to the emulator's configuration file, located at: | ||
|
||
> `<$env:USERPROFILE>\.android\avd\<emulator name>\config.ini` | ||
So, in the example: | ||
|
||
> `C:\Users\username\.android\avd\Pixel4_api30_android11_x64.avd\config.ini` | ||
- `nhw.lcd.width = 720` and `nhw.lcd.height = 1280` set the resolution to 720p | ||
- `nhw.lcd.density = 240` sets DPI to an acceptable level | ||
- `nhw.keyboard = yes` is needed for full functioning of the computer keyboard (eg. copy-pasting) | ||
|
||
## Run the emulator | ||
|
||
Just run this command every time you have to start the emulator. | ||
|
||
```powershell | ||
# emulator -avd <emulator name> | ||
emulator -avd Pixel4_api30_android11_x64 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# fastboot-snippets.md | ||
|
||
## Poweroff the phone | ||
|
||
NB: works only if the OEM command is supported. | ||
|
||
```shell | ||
fastboot oem poweroff | ||
``` |