31 lines
1.4 KiB
Markdown
31 lines
1.4 KiB
Markdown
# Docker for Android SDK
|
|
|
|
Docker for Android SDK with preinstalled build tools and emulator image
|
|
|
|
> Edit from [docker-android-sdk/android-31](https://github.com/docker-android-sdk/android-31)
|
|
|
|
**Usage**
|
|
|
|
- Interactive way
|
|
```bash
|
|
$ docker run -it --rm --device /dev/kvm git.cuernodehipnos.es/marown/android-sdk-docker:latest bash
|
|
# check installed packages
|
|
$ sdkmanager --list
|
|
# create and run emulator
|
|
$ avdmanager --verbose create avd --force --name "generic_34" --package "system-images;android-34;google_apis;x86_64" --tag "google_apis" --abi "x86_64"
|
|
$ emulator -avd "generic_34" -no-window -no-audio -no-boot-anim -netdelay none -no-snapshot -wipe-data &
|
|
$ 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 git.cuernodehipnos.es/marown/android-sdk-docker:latest sdkmanager --list
|
|
# list existing emulators
|
|
$ docker run -it --rm git.cuernodehipnos.es/marown/android-sdk-docker:latest avdmanager list avd
|
|
# You can also run other Android platform tools, which are all added to the PATH environment variable
|
|
``` |