blob: 17c34300814f1714c6c37db70250b53a770b6052 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# Docker for Android SDK 31
Docker for Android SDK 31 with preinstalled build tools and emulator image
> Edit from [mindrunner/docker-android-sdk](https://github.com/mindrunner/docker-android-sdk)
**Installed Packages**
```bash
# sdkmanager --list
Path | Version | Description | Location
------- | ------- | ------- | -------
build-tools;32.0.0 | 32.0.0 | Android SDK Build-Tools 32 | build-tools/32.0.0
cmdline-tools;latest | 6.0 | Android SDK Command-line Tools (latest) | cmdline-tools/latest
emulator | 31.2.8 | Android Emulator | emulator
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4
platform-tools | 32.0.0 | Android SDK Platform-Tools | platform-tools
platforms;android-31 | 1 | Android SDK Platform 31 | platforms/android-31
system-images;android-31;google_apis;x86_64 | 8 | Google APIs Intel x86 Atom_64 System Image | system-images/android-31/google_apis/x86_64
```
**Usage**
- Interactive way
```bash
$ docker run -it --rm --device /dev/kvm androidsdk/android-31:latest bash
# check installed packages
$ sdkmanager --list
# create and run emulator
$ avdmanager create avd -n first_avd --abi google_apis/x86_64 -k "system-images;android-31;google_apis;x86_64"
$ emulator -avd first_avd -no-window -no-audio &
$ adb devices
# You can also run other Android platform tools, which are all added to the PATH environment variable
```
To connect the emulator using `adb` on the docker host machine, start the container with `--network host` as well.
You could also use [`scrcpy`](https://github.com/Genymobile/scrcpy) to do a screencast of the emulator.
- Non-interactive way
```bash
# check installed packages
$ docker run -it --rm androidsdk/android-31:latest sdkmanager --list
# list existing emulators
$ docker run -it --rm androidsdk/android-31:latest avdmanager list avd
# You can also run other Android platform tools, which are all added to the PATH environment variable
```
|