2022-07-17 08:59:53 +02:00
|
|
|
# Docker for Android SDK
|
2020-10-07 23:58:47 +02:00
|
|
|
|
2022-07-17 08:59:53 +02:00
|
|
|
Docker for Android SDK with preinstalled build tools and emulator image
|
2020-10-07 23:58:47 +02:00
|
|
|
|
2022-07-17 08:59:53 +02:00
|
|
|
> Edit from [docker-android-sdk/android-31](https://github.com/docker-android-sdk/android-31)
|
2020-10-07 23:58:47 +02:00
|
|
|
|
|
|
|
**Installed Packages**
|
|
|
|
```bash
|
|
|
|
# sdkmanager --list
|
2022-02-09 15:09:55 +01:00
|
|
|
Path | Version | Description | Location
|
|
|
|
------- | ------- | ------- | -------
|
2022-07-17 08:59:53 +02:00
|
|
|
build-tools;33.0.0 | 33.0.0 | Android SDK Build-Tools 33 | build-tools/33.0.0
|
|
|
|
cmdline-tools;latest | 7.0 | Android SDK Command-line Tools (latest) | cmdline-tools/latest
|
|
|
|
emulator | 31.2.10 | Android Emulator | emulator
|
2022-02-09 15:09:55 +01:00
|
|
|
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4
|
2022-07-17 08:59:53 +02:00
|
|
|
platform-tools | 33.0.2 | Android SDK Platform-Tools | platform-tools
|
|
|
|
platforms;android-33 | 2 | Android SDK Platform 33 | platforms/android-33
|
|
|
|
system-images;android-33;google_apis;x86_64 | 6 | Google APIs Intel x86 Atom_64 System Image | system-images/android-33/google_apis/x86_64
|
|
|
|
|
2020-10-07 23:58:47 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
**Usage**
|
|
|
|
|
|
|
|
- Interactive way
|
|
|
|
```bash
|
2022-07-17 08:59:53 +02:00
|
|
|
$ docker run -it --rm --device /dev/kvm juanmi/android-sdk-docker:latest bash
|
2020-10-07 23:58:47 +02:00
|
|
|
# check installed packages
|
|
|
|
$ sdkmanager --list
|
|
|
|
# create and run emulator
|
2022-07-17 08:59:53 +02:00
|
|
|
$ avdmanager --verbose create avd --force --name "generic_33" --package "system-images;android-33;google_apis;x86_64" --tag "google_apis" --abi "x86_64"
|
|
|
|
$ emulator -avd "generic_33" -no-window -no-audio -no-boot-anim -netdelay none -no-snapshot -wipe-data &
|
2020-10-07 23:58:47 +02:00
|
|
|
$ adb devices
|
|
|
|
# You can also run other Android platform tools, which are all added to the PATH environment variable
|
|
|
|
```
|
|
|
|
|
2021-07-13 06:33:41 +02:00
|
|
|
To connect the emulator using `adb` on the docker host machine, start the container with `--network host` as well.
|
2020-10-07 23:58:47 +02:00
|
|
|
You could also use [`scrcpy`](https://github.com/Genymobile/scrcpy) to do a screencast of the emulator.
|
|
|
|
|
|
|
|
- Non-interactive way
|
|
|
|
```bash
|
|
|
|
# check installed packages
|
2022-07-17 08:59:53 +02:00
|
|
|
$ docker run -it --rm juanmi/android-sdk-docker:latest sdkmanager --list
|
2020-10-07 23:58:47 +02:00
|
|
|
# list existing emulators
|
2022-07-17 08:59:53 +02:00
|
|
|
$ docker run -it --rm juanmi/android-sdk-docker:latest avdmanager list avd
|
2020-10-07 23:58:47 +02:00
|
|
|
# You can also run other Android platform tools, which are all added to the PATH environment variable
|
|
|
|
```
|