{"id":13442971,"url":"https://github.com/thyrlian/AndroidSDK","last_synced_at":"2025-03-20T15:31:41.179Z","repository":{"id":38983244,"uuid":"64508433","full_name":"thyrlian/AndroidSDK","owner":"thyrlian","description":"🐳 Full-fledged Android SDK Docker Image","archived":false,"fork":false,"pushed_at":"2024-09-29T19:52:28.000Z","size":3486,"stargazers_count":1292,"open_issues_count":2,"forks_count":217,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-03-11T11:13:02.553Z","etag":null,"topics":["android","android-sdk","build","ci","containerization","continuous-integration","docker","docker-container","docker-image","emulator","gradle","hack","hacking","kotlin","vnc"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thyrlian.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"thyrlian","patreon":"thyrlian"}},"created_at":"2016-07-29T20:26:00.000Z","updated_at":"2025-02-26T14:39:15.000Z","dependencies_parsed_at":"2024-04-14T15:33:47.365Z","dependency_job_id":"69445782-0ff0-4aae-8b38-15fb17f9d3b0","html_url":"https://github.com/thyrlian/AndroidSDK","commit_stats":{"total_commits":443,"total_committers":17,"mean_commits":"26.058823529411764","dds":"0.10835214446952601","last_synced_commit":"1667a40960fdb705b1df26f5e7b90de2712648b3"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyrlian%2FAndroidSDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyrlian%2FAndroidSDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyrlian%2FAndroidSDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyrlian%2FAndroidSDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thyrlian","download_url":"https://codeload.github.com/thyrlian/AndroidSDK/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244217930,"owners_count":20417677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-sdk","build","ci","containerization","continuous-integration","docker","docker-container","docker-image","emulator","gradle","hack","hacking","kotlin","vnc"],"created_at":"2024-07-31T03:01:54.066Z","updated_at":"2025-03-20T15:31:40.563Z","avatar_url":"https://github.com/thyrlian.png","language":"Shell","readme":"# AndroidSDK\n\nAndroid SDK development environment Docker image\n\n[![Docker Hub](https://img.shields.io/badge/Docker%20Hub-info-blue.svg)](https://hub.docker.com/r/thyrlian/android-sdk/)\n[![Docker Stars](https://img.shields.io/docker/stars/thyrlian/android-sdk.svg)](https://hub.docker.com/r/thyrlian/android-sdk/)\n[![Docker Pulls](https://img.shields.io/docker/pulls/thyrlian/android-sdk.svg)](https://hub.docker.com/r/thyrlian/android-sdk/)\n[![CI](https://github.com/thyrlian/AndroidSDK/actions/workflows/docker-image.yml/badge.svg)](https://github.com/thyrlian/AndroidSDK/actions/workflows/docker-image.yml)\n[![Join the chat at https://gitter.im/AndroidSDK-Docker/AndroidSDK-Docker](https://badges.gitter.im/AndroidSDK-Docker/AndroidSDK-Docker.svg)](https://gitter.im/AndroidSDK-Docker/AndroidSDK-Docker)\n[![Android Dev Digest](https://img.shields.io/badge/AndroidDevDigest-%23127-green.svg)](https://www.androiddevdigest.com/digest-127/)\n[![Android开发技术周报](https://img.shields.io/badge/Android%E5%BC%80%E5%8F%91%E6%8A%80%E6%9C%AF%E5%91%A8%E6%8A%A5-%23114-yellowgreen.svg)](http://www.androidweekly.cn/android-dev-weekly-issue-114/)\n[![HelloGitHub](https://img.shields.io/badge/HelloGitHub-%2359-blue.svg)](https://hellogithub.com/periodical/volume/59/#AndroidSDK)\n[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fthyrlian%2FAndroidSDK\u0026count_bg=%233DDC84\u0026title_bg=%230DB7ED\u0026icon=\u0026icon_color=%23E7E7E7\u0026title=hits\u0026edge_flat=false)](https://github.com/thyrlian/AndroidSDK)\n\n[![Docker Badge](https://dockerico.blankenship.io/image/thyrlian/android-sdk)](https://hub.docker.com/r/thyrlian/android-sdk)\n\n\u003cimg src=\"https://github.com/thyrlian/AndroidSDK/blob/master/assets/logo.png?raw=true\" width=\"200\"\u003e\n\n\u003ca href=\"https://youtu.be/YwBAqMDYFCU\"\u003e\u003cimg src=\"https://pbs.twimg.com/media/DODnbwmXkAAbXuM.jpg\" alt=\"Conference Talk\" width=\"600\"\u003e\u003c/a\u003e\n\n## Goals\n\n* It contains the complete Android SDK enviroment, is able to perform all regular Android jobs.\n\n* Solves the problem of \"*It works on my machine, but not on XXX machine*\".\n\n* Some tool (e.g. [Infer](https://github.com/facebook/infer)), which has complex dependencies might be in conflict with your local environment.  Installing the tool within a Docker container is the easiest and perfect solution.\n\n* Works out of the box as an Android CI build enviroment.\n\n## Philosophy\n\nProvide only the **barebone SDK** (the latest official minimal package) gives you the **maximum flexibility** in tailoring your own SDK tools for your project.  You can maintain an external **persistent** SDK directory, and mount it to any container.  In this way, you don't have to waste time on downloading over and over again, meanwhile, without having any unnecessary package.  Additionally, instead of one dedicated Docker image per Android API level (which will end up with a ton of images), you just have to deal with **one image**.  Last but not least, according to Android's [terms and conditions](https://developer.android.com/studio/terms), one may not **redistribute** the SDK or any part of the SDK.\n\n### Note\n\n**Gradle** and **Kotlin compiler** come together with this Docker image merely for the sake of convenience / trial.\n\n**[Using the Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:using_wrapper)**\n\n\u003e It is recommended to always execute a build with the Wrapper to ensure a reliable, controlled and standardized execution of the build.  Using the Wrapper looks almost exactly like running the build with a Gradle installation.  In case the Gradle distribution is not available on the machine, the Wrapper will download it and store in the local file system.  Any subsequent build invocation is going to reuse the existing local distribution as long as the distribution URL in the Gradle properties doesn’t change.\n\nUsing the Gradle Wrapper lets you build with a precise Gradle version, in order to eliminate any Gradle version problem.\n\n* `\u003cyour_project\u003e/gradle/wrapper/gradle-wrapper.properties` specifies the Gradle version\n* Gradle will be downloaded and unzipped to `~/.gradle/wrapper/dists/`\n* `kotlin-compiler-embeddable-x.y.z.jar` will be resolved and downloaded when executing a Gradle task, it's defined in `\u003cyour_project\u003e/build.gradle` as `classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version\"`\n\n## Caveat\n\nPreviously, running Android SDK update within the **Dockerfile** or inside a **container** would fail with [`AUFS`](https://en.wikipedia.org/wiki/Aufs) storage driver, it was due to hardlink move operations (during updating Android SDK) are not supported by AUFS storage driver, but changing it to other storage driver would work.  Fortunately, it's not the case any more.  With the latest version of Docker Engine, it works like a charm, you can do whatever you prefer.  If you're not interested in the technical cause, simply skip this section (jump to the [next section](https://github.com/thyrlian/AndroidSDK#getting-started)).\n\nWhat happens if the update fails?\n\n  ```bash\n  ls $ANDROID_HOME/cmdline-tools/tools/\n  #=\u003e empty, nothing is there\n  # tools such as: android, sdkmanager, emulator, lint and etc. are gone\n  \n  android\n  #=\u003e bash: android: command not found\n  \n  sdkmanager\n  #=\u003e bash: /opt/android-sdk/cmdline-tools/tools/bin/sdkmanager: No such file or directory\n  ```\n\nTo prevent this problem from happening, and you don't wanna bother modifying storage driver.  The only solution is to mount an external SDK volume from host to container.  Then you are free to try any of below approaches.\n\n* Update SDK in the usual way but directly inside container.\n\n* Update SDK from host directory (**Remember**: the host machine must be the same target architecture as the container - `x86_64 Linux`).\n\nIf you by accident update SDK on a host machine which has a mismatch target architecture than the container, some binaries won't be executable in container any longer.\n\n  ```bash\n  gradle \u003csome_task\u003e\n  #=\u003e Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: AAPT process not ready to receive commands\n  \n  $ANDROID_HOME/build-tools/x.x.x/aapt\n  #=\u003e aapt: cannot execute binary file: Exec format error\n  \n  adb\n  #=\u003e adb: cannot execute binary file: Exec format error\n  ```\n\nNote:\n\n* \u003e [Docker Desktop for Mac and Docker Desktop for Windows are intended for development, rather than production. Modifying the storage driver on these platforms is not possible.](https://docs.docker.com/storage/storagedriver/select-storage-driver/#docker-desktop-for-mac-and-docker-desktop-for-windows)\n\n* AUFS storage driver was deprecated in *Docker Community Edition 18.06.0-ce-mac70 2018-07-25*.  And AUFS support was removed in *Docker Community Edition 2.0.0.0-mac78 2018-11-19*.  For more details, please check [Docker for Mac Stable release notes](https://docs.docker.com/docker-for-mac/release-notes/).\n\nMore information about **storage driver**:\n\n* Check Docker's current storage driver option\n\n  ```console\n  docker info | grep 'Storage Driver'\n  ```\n\n* Check which filesystems are supported by the running host kernel\n\n  ```console\n  cat /proc/filesystems\n  ```\n\n* Some storage drivers only work with specific backing filesystems.  Check [supported backing filesystems](https://docs.docker.com/storage/storagedriver/select-storage-driver/#supported-backing-filesystems) for further details.\n\n* In order to change the storage driver, you need to edit the [**daemon configuration file**](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file), or go to **Docker Desktop** -\u003e **Preferences...** -\u003e **Daemon** -\u003e **Advanced**.\n\n  ```console\n  {\n    \"storage-driver\": \"\"\n  }\n  ```\n\n## Getting Started\n\n```bash\n# build the image\n# set the working directory to the project's root directory first\ndocker build -t android-sdk android-sdk\n# or you can also pass specific tool version as you wish (optional, while there is default version)\ndocker build --build-arg JDK_VERSION=\u003cjdk_version\u003e --build-arg GRADLE_VERSION=\u003cgradle_version\u003e --build-arg KOTLIN_VERSION=\u003ckotlin_version\u003e --build-arg ANDROID_SDK_VERSION=\u003candroid_sdk_version\u003e -t android-sdk android-sdk\n# or pull the image instead of building on your own\ndocker pull thyrlian/android-sdk\n\n# below commands assume that you've pulled the image\n\n# copy the pre-downloaded SDK to the mounted 'sdk' directory\ndocker run -it --rm -v $(pwd)/sdk:/sdk thyrlian/android-sdk bash -c 'cp -a $ANDROID_HOME/. /sdk'\n\n# go to the 'sdk' directory on the host, update the SDK\n# ONLY IF the host machine is the same target architecture as the container\n# JDK required on the host\nsdk/cmdline-tools/tools/bin/sdkmanager --update\n# or install specific packages\nsdk/cmdline-tools/tools/bin/sdkmanager \"build-tools;x.y.z\" \"platforms;android-\u003capi_level\u003e\" ...\n\n# mount the updated SDK to container again\n# if the host SDK directory is mounted to more than one container\n# to avoid multiple containers writing to the SDK directory at the same time\n# you should mount the SDK volume in read-only mode\ndocker run -it -v $(pwd)/sdk:/opt/android-sdk:ro thyrlian/android-sdk /bin/bash\n\n# you can mount without read-only option, only if you need to update SDK inside container\ndocker run -it -v $(pwd)/sdk:/opt/android-sdk thyrlian/android-sdk /bin/bash\n\n# to keep and reuse Gradle cache\ndocker run -it -v $(pwd)/sdk:/opt/android-sdk -v $(pwd)/gradle-caches:/root/.gradle/caches thyrlian/android-sdk /bin/bash\n\n# to stop and remove container\n# when the image was pulled from a registry\ndocker stop $(docker ps -aqf \"ancestor=thyrlian/android-sdk\") \u0026\u003e /dev/null \u0026\u0026 docker rm $(docker ps -aqf \"ancestor=thyrlian/android-sdk\") \u0026\u003e /dev/null\n# when the image was built locally\ndocker stop $(docker ps -aqf \"ancestor=android-sdk\") \u0026\u003e /dev/null \u0026\u0026 docker rm $(docker ps -aqf \"ancestor=android-sdk\") \u0026\u003e /dev/null\n# more flexible way - doesn't matter where the image comes from\ndocker stop $(docker ps -a | grep 'android-sdk' | awk '{ print $1 }') \u0026\u003e /dev/null \u0026\u0026 docker rm $(docker ps -a | grep 'android-sdk' | awk '{ print $1 }') \u0026\u003e /dev/null\n```\n\n### Accepting Licenses\n\nA helper script is provided at [`/opt/license-accepter.sh`](https://github.com/thyrlian/AndroidSDK/blob/master/android-sdk/license-accepter.sh) for accepting the SDK and its various licenses.  This is helpful in non-interactive environments such as CI builds.\n\n## SSH\n\nIt is also possible if you wanna connect to container via SSH.  There are three different approaches.\n\n* Build an image on your own, with a built-in `authorized_keys`\n\n  ```bash\n  # Put your `id_rsa.pub` under `android-sdk/accredited-keys` directory (as many as you want)\n\n  # Build an image, then an `authorized_keys` file will be composed automatically, based on the keys from `android-sdk/accredited-keys` directory\n  docker build -t android-sdk android-sdk\n  \n  # Run a container\n  docker run -d -p 2222:22 -v $(pwd)/sdk:/opt/android-sdk:ro android-sdk\n  ```\n\n* Mount `authorized_keys` file from the host to a container\n\n  ```bash\n  # Make sure your local authorized_keys file has the correct permission set\n  chmod 600 $(pwd)/authorized_keys\n  sudo chown root:root authorized_keys\n  \n  docker run -d -p 2222:22 -v $(pwd)/authorized_keys:/root/.ssh/authorized_keys thyrlian/android-sdk\n  ```\n\n* Copy a local `authorized_keys` file to a container\n\n  ```bash\n  # Create a local `authorized_keys` file, which contains the content from your `id_rsa.pub`\n  # Make sure your local authorized_keys file has the correct permission set\n  chmod 600 $(pwd)/authorized_keys\n  \n  # Run a container\n  docker run -d -p 2222:22 -v $(pwd)/sdk:/opt/android-sdk:ro thyrlian/android-sdk\n  \n  # Copy the just created local authorized_keys file to the running container\n  docker cp $(pwd)/authorized_keys `docker ps -aqf \"ancestor=thyrlian/android-sdk\"`:/root/.ssh/authorized_keys\n  \n  # Set the proper owner and group for authorized_keys file\n  docker exec -it `docker ps -aqf \"ancestor=thyrlian/android-sdk\"` bash -c 'chown root:root /root/.ssh/authorized_keys'\n  ```\n\nThat's it!  Now it's up and running, you can ssh to it\n\n  ```console\n  ssh root@\u003ccontainer_ip_address\u003e -p 2222\n  ```\n\nAnd, in case you need, you can still attach to the running container (not via ssh) by\n\n  ```console\n  docker exec -it \u003ccontainer_id\u003e /bin/bash\n  ```\n\n\u003cimg src=\"https://github.com/thyrlian/AndroidSDK/blob/master/assets/SSH.png?raw=true\"\u003e\n\n## VNC\n\nRemote access to the container's desktop might be helpful if you plan to run emulator inside the container.\n\n  ```bash\n  # pull the image with VNC support\n  docker pull thyrlian/android-sdk-vnc\n  \n  # spin up a container with SSH\n  # won't work when spin up with interactive session, since the vncserver won't get launched\n  docker run -d -p 5901:5901 -p 2222:22 -v $(pwd)/sdk:/opt/android-sdk thyrlian/android-sdk-vnc\n  ```\n\nWhen the container is up and running, use your favorite VNC client to connect to it:\n\n* `\u003ccontainer_ip_address\u003e:5901`\n\n* Password (with control): ***android***\n\n* Password (view only): ***docker***\n\n```bash\n# setup and launch emulator inside the container\n# create a new Android Virtual Device\necho \"no\" | avdmanager create avd -n test -k \"system-images;android-25;google_apis;armeabi-v7a\"\n# launch emulator\nemulator -avd test -no-audio -no-boot-anim -accel on -gpu swiftshader_indirect \u0026\n```\n\nFor more details, please refer to [Emulator section](https://github.com/thyrlian/AndroidSDK#emulator).\n\n\u003cimg src=\"https://github.com/thyrlian/AndroidSDK/blob/master/assets/vnc.png?raw=true\"\u003e\n\n### VNC client recommendation\n\n* macOS: [Screen Sharing](https://support.apple.com/guide/mac-help/share-the-screen-of-another-mac-mh14066/mac)\n* Linux: [Remmina](https://remmina.org/)\n* Cross-Platform: [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/)\n\n## NFS\n\nYou can host the Android SDK in one host-independent place, and share it across different containers.  One solution is using NFS (Network File System).\n\nTo make the container consume the NFS, you can try either way below:\n\n* Mount the NFS onto your host machine, then run container with volume option (`-v`).\n\n* Use a Docker volume plugin, for instance [Convoy plugin](https://github.com/rancher/convoy).\n\nAnd here are instructions for configuring a NFS server (on Ubuntu):\n\n  ```bash\n  sudo apt-get update\n  sudo apt-get install -y nfs-kernel-server\n  sudo mkdir -p /var/nfs/android-sdk\n  \n  # put the Android SDK under /var/nfs/android-sdk\n  # if you haven't got any, run below commands\n  sudo apt-get install -y wget zip\n  cd /var/nfs/android-sdk\n  sudo wget -q $(wget -q -O- 'https://developer.android.com/sdk' | grep -o \"\\\"https://.*android.*tools.*linux.*\\\"\" | sed \"s/\\\"//g\")\n  sudo unzip *tools*linux*.zip\n  sudo rm *tools*linux*.zip\n  sudo mkdir licenses\n  echo 8933bad161af4178b1185d1a37fbf41ea5269c55 | sudo tee licenses/android-sdk-license \u003e /dev/null\n  echo 84831b9409646a918e30573bab4c9c91346d8abd | sudo tee licenses/android-sdk-preview-license \u003e /dev/null\n  echo d975f751698a77b662f1254ddbeed3901e976f5a | sudo tee licenses/intel-android-extra-license \u003e /dev/null\n  \n  # configure and launch NFS service\n  sudo chown nobody:nogroup /var/nfs\n  echo \"/var/nfs         *(rw,sync,no_subtree_check,no_root_squash)\" | sudo tee --append /etc/exports \u003e /dev/null\n  sudo exportfs -a\n  sudo service nfs-kernel-server start\n  ```\n\n## Gradle Distributions Mirror Server\n\nThere is still room for optimization: recent distribution of Gradle is around 100MB, imagine different containers / build jobs have to perform downloading over and over again, and it has high influence upon your network bandwidth.  Setting up a local Gradle distributions mirror server would significantly boost your download speed.\n\nFortunately, you can easily build such a mirror server docker image on your own.\n\n  ```bash\n  docker build -t gradle-server gradle-server\n  # by default it downloads the most recent 14 gradle distributions (excluding rc or milestone)\n  # or you can also pass how many gradle distributions should be downloaded\n  docker build --build-arg GRADLE_DOWNLOAD_AMOUNT=\u003camount_of_gradle_distributions_to_be_downloaded\u003e -t gradle-server gradle-server\n  ```\n\nPreferably, you should run the [download script](https://github.com/thyrlian/AndroidSDK/blob/master/gradle-server/gradle-downloader.sh) locally, and mount the download directory to the container.\n\n  ```bash\n  gradle-server/gradle-downloader.sh [DOWNLOAD_DIRECTORY] [DOWNLOAD_AMOUNT]\n  docker run -d -p 80:80 -p 443:443 -v [DOWNLOAD_DIRECTORY]:/var/www/gradle.org/public_html/distributions gradle-server\n  ```\n\n  ```bash\n  # copy the SSL certificate from gradle server container to host machine\n  docker cp `docker ps -aqf \"ancestor=gradle-server\"`:/etc/apache2/ssl/apache.crt apache.crt\n  # copy the SSL certificate from host machine to AndroidSDK container\n  docker cp apache.crt `docker ps -aqf \"ancestor=thyrlian/android-sdk\"`:/home/apache.crt\n  # add self-signed SSL certificate to Java keystore\n  docker exec -it `docker ps -aqf \"ancestor=thyrlian/android-sdk\"` bash -c '$JAVA_HOME/bin/keytool -import -trustcacerts -file /home/apache.crt -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -noprompt'\n  # map gradle services domain to your local IP\n  docker exec -it `docker ps -aqf \"ancestor=thyrlian/android-sdk\"` bash -c 'echo \"[YOUR_HOST_IP_ADDRESS_FOR_GRADLE_CONTAINER] services.gradle.org\" \u003e\u003e /etc/hosts'\n  ```\n\nStarting from now on, gradle wrapper will download gradle distributions from your local mirror server, lightning fast!  The downloaded distribution will be uncompressed to `/root/.gradle/wrapper/dists`.\n\nIf you don't want to bother with SSL certificate, you can simply change the `distributionUrl` inside `[YOUR_PROJECT]/gradle/wrapper/gradle-wrapper.properties` from `https` to `http`.\n\n## Emulator\n\nARM emulator is host machine independent, can run anywhere - Linux, macOS, VM and etc.  While the performance is a bit poor.  On the contrary, x86 emulator requires KVM, which means only runnable on Linux.\n\nAccording to [Google's documentation](https://developer.android.com/studio/run/emulator-acceleration.html#accel-vm):\n\n  \u003e **VM acceleration restrictions**\n  \u003e\n  \u003e Note the following restrictions of VM acceleration:\n  \u003e\n  \u003e * You can't run a VM-accelerated emulator inside another VM, such as a VM hosted by VirtualBox, VMWare, or Docker. You must run the emulator directly on your system hardware.\n  \u003e\n  \u003e * You can't run software that uses another virtualization technology at the same time that you run the accelerated emulator. For example, VirtualBox, VMWare, and Docker currently use a different virtualization technology, so you can't run them at the same time as the accelerated emulator.\n\n### Preconditions on the host machine (for x86 emulator)\n\nRead [How to Start Intel Hardware-assisted Virtualization (hypervisor) on Linux](https://software.intel.com/en-us/blogs/2012/03/12/how-to-start-intel-hardware-assisted-virtualization-hypervisor-on-linux-to-speed-up-intel-android-x86-emulator) for more details.\n\nRead [KVM Installation](https://help.ubuntu.com/community/KVM/Installation) if you haven't got KVM installed on the host yet.\n\n* Check the capability of running KVM\n\n  ```bash\n  grep -cw \".*\\(vmx\\|svm\\).*\" /proc/cpuinfo\n  # or\n  egrep -c '(vmx|svm)' /proc/cpuinfo\n  # a non-zero result means the host CPU supports hardware virtualization.\n  \n  sudo kvm-ok\n  # seeing below info means you can run your virtual machine faster with the KVM extensions\n  INFO: /dev/kvm exists\n  KVM acceleration can be used\n  ```\n\n* Load KVM module on the host\n\n  ```console\n  sudo modprobe kvm\n  # or for Intel processors\n  sudo modprobe kvm-intel\n  # or for AMD processors\n  sudo modprobe kvm-amd\n  ```\n\n* Check if KVM module is successfully loaded\n\n  ```console\n  lsmod | grep kvm\n  ```\n\n### Where can I run x86 emulator\n\n* Linux physical machine\n\n* Cloud computing services (must support nested virtualization)\n\n  **Note**: there will be a performance penalty, primarily for CPU bound workloads and I/O bound workloads.\n\n  * [Amazon Web Services](https://aws.amazon.com/blogs/compute/running-hyper-v-on-amazon-ec2-bare-metal-instances/)\n\n  * [Google Cloud Platform](https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances)\n  \n  * [IBM Cloud](https://www.ibm.com/developerworks/cloud/library/cl-nestedvirtualization/index.html)\n\n  * [Microsoft Azure](https://azure.microsoft.com/en-us/blog/nested-virtualization-in-azure/)\n\n* [VirtualBox](https://www.virtualbox.org/) (since 6.0.0, it started supporting nested virtualization, which could be turned on by \"Enable Nested VT-x/AMD-V\", but at the moment, it's only for AMD CPUs)\n\n### How to run emulator\n\n* Check available emulator system images from remote SDK repository\n\n  ```console\n  sdkmanager --list --verbose\n  ```\n\n* Make sure that the required SDK packages are installed, you can find out by above command.  To install, use the command below.  Whenever you see error complains about `ANDROID_SDK_ROOT` (or `ANDROID_HOME`), such as `PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT` or `PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value`, it means that you need to install following packages.\n\n  ```console\n  sdkmanager \"platform-tools\" \"platforms;android-\u003capi_level\u003e\" \"emulator\"\n  ```\n\n* Download emulator system image(s) (on the host machine)\n\n  ```bash\n  sdkmanager \"system_image_1\" \"system_image_2\"\n  # e.g.:\n  # system-images;android-24;android-tv;x86\n  # system-images;android-24;default;arm64-v8a\n  # system-images;android-24;default;armeabi-v7a\n  # system-images;android-24;default;x86\n  # system-images;android-24;default;x86_64\n  # system-images;android-24;google_apis;arm64-v8a\n  # system-images;android-24;google_apis;armeabi-v7a\n  # system-images;android-24;google_apis;x86\n  # system-images;android-24;google_apis;x86_64\n  # system-images;android-24;google_apis_playstore;x86\n  ```\n\n* Run Docker container in privileged mode (not necessary for ARM emulator)\n\n  ```bash\n  # required by KVM\n  docker run -it --privileged -v $(pwd)/sdk:/opt/android-sdk:ro thyrlian/android-sdk /bin/bash\n  ```\n\n* Check acceleration ability (not necessary for ARM emulator)\n\n  ```bash\n  emulator -accel-check\n  \n  # when succeeds\n  accel:\n  0\n  KVM (version 12) is installed and usable.\n  accel\n  \n  # when fails (probably due to unprivileged mode)\n  accel:\n  8\n  /dev/kvm is not found: VT disabled in BIOS or KVM kernel module not loaded\n  accel\n  ```\n\n* Create a new Android Virtual Device\n\n  ```bash\n  echo \"no\" | avdmanager create avd -n \u003cname\u003e -k \u003csdk_id\u003e\n  # e.g.:\n  echo \"no\" | avdmanager create avd -n test -k \"system-images;android-24;default;armeabi-v7a\"\n  ```\n\n* List existing Android Virtual Devices\n\n  ```bash\n  avdmanager list avd\n  # ==================================================\n  Available Android Virtual Devices:\n      Name: test\n      Path: /root/.android/avd/test.avd\n    Target: Default Android System Image\n            Based on: Android 7.0 (Nougat) Tag/ABI: default/armeabi-v7a\n  # ==================================================\n  \n  # or\n  \n  emulator -list-avds\n  # 32-bit Linux Android emulator binaries are DEPRECATED\n  # ==================================================\n  test\n  # ==================================================\n  ```\n\n* Launch emulator in background\n\n  ```bash\n  emulator -avd \u003cvirtual_device_name\u003e -no-audio -no-boot-anim -no-window -accel on -gpu off \u0026\n  \n  # if the container is not running in privileged mode, you should see below errors:\n  #=\u003e emulator: ERROR: x86_64 emulation currently requires hardware acceleration!\n  #=\u003e Please ensure KVM is properly installed and usable.\n  #=\u003e CPU acceleration status: /dev/kvm is not found: VT disabled in BIOS or KVM kernel module not loaded\n  # or it's running on top of a VM\n  #=\u003e CPU acceleration status: KVM requires a CPU that supports vmx or svm\n  ```\n\n* Check the virtual device status\n\n  ```bash\n  adb devices\n  # ==================================================\n  List of devices attached\n  emulator-5554\toffline\n  # \"offline\" means it's still booting up\n  # ==================================================\n  \n  # ==================================================\n  List of devices attached\n  emulator-5554\tdevice\n  # \"device\" means it's ready to be used\n  # ==================================================\n  ```\n\nNow you can for instance run UI tests on the emulator (just remember, the performance is POOR):\n\n  ```console\n  \u003cyour_android_project\u003e/gradlew connectedAndroidTest\n  ```\n\n### Troubleshooting emulator\n\nIf you encounter an error \"***Process system isn't responding***\" in the emulator, like below:\n\n\u003cimg src=\"https://github.com/thyrlian/AndroidSDK/blob/master/assets/emulator-error-process-not-responding.png?raw=true\"\u003e\n\nYou could try:\n\n* Increase the limit of the memory resource available to Docker Engine.\n\n* Increase the amount of physical RAM on the emulator by setting / changing `hw.ramSize` in the AVD's configuration file (`config.ini`).  By default, it's not set and the default value is \"96\" (in megabytes).  You could simply set a new value via this command: `echo \"hw.ramSize=1024\" \u003e\u003e /root/.android/avd/\u003cyour_avd_name\u003e.avd/config.ini`\n\n### Access the emulator from outside\n\nDefault adb server port: `5037`\n\n  ```bash\n  # spin up a container\n  # with SSH\n  docker run -d -p 5037:5037 -p 2222:22 -v $(pwd)/sdk:/opt/android-sdk thyrlian/android-sdk-vnc\n  # or with interactive session\n  docker run -it -p 5037:5037 -v $(pwd)/sdk:/opt/android-sdk thyrlian/android-sdk-vnc /bin/bash\n  \n  # launch emulator inside the container...\n  ```\n\nOutside the container:\n\n  ```bash\n  adb connect \u003ccontainer_ip_address\u003e:5037\n  adb devices\n  #=\u003e List of devices attached\n  #=\u003e emulator-5554\tdevice\n  ```\n\nMake sure that your **adb client** talks to the **adb server** inside the container, instead of the local one on the host machine.  This can be achieved by running `adb kill-server` (to kill the local server if it's already up) before firing `adb connect` command above.\n\n## Android Device\n\nYou can give a container access to host's USB Android devices.\n\n  ```console\n  # on Linux\n  docker run -it --privileged -v /dev/bus/usb:/dev/bus/usb -v $(pwd)/sdk:/opt/android-sdk thyrlian/android-sdk /bin/bash\n  \n  # or\n  # try to avoid privileged flag, just add necessary capabilities when possible\n  # --device option allows you to run devices inside the container without the --privileged flag\n  docker run -it --device=/dev/ttyUSB0 -v $(pwd)/sdk:/opt/android-sdk thyrlian/android-sdk /bin/bash\n  ```\n\nNote:\n\n* Connect Android device via USB on host first;\n\n* Launch container;\n\n* Disconnect and connect Android device on USB;\n\n* Select OK for \"Allow USB debugging\" on Android device;\n\n* Now the Android device will show up inside the container (`adb devices`).\n\nDon't worry about `adbkey` or `adbkey.pub` under `/.android`, not required.\n\n[Docker for Mac FAQ](https://docs.docker.com/docker-for-mac/faqs/#can-i-pass-through-a-usb-device-to-a-container) says:\n\n  \u003e Unfortunately it is not possible to pass through a USB device (or a serial port) to a container.\n\n## Firebase Test Lab\n\nYou can also run UI tests on Google's [Firebase Test Lab](https://firebase.google.com/docs/test-lab) with emulators or physical devices.\n\nTo create and configure a project on the platform:\n\n* Create a project in [Google Cloud Platform](https://console.cloud.google.com/cloud-resource-manager) if you haven't created one yet.\n\n* Create a project in [Firebase](https://console.firebase.google.com/):\n\n    * Choose the recently created Google Cloud Platform project to add Firebase services to it.\n    \n    * Confirm Firebase billing plan.\n\n* Go to **IAM \u0026 Admin** -\u003e **Service Accounts** in [Google Cloud Platform](https://console.cloud.google.com/iam-admin/serviceaccounts):\n\n    * Edit the Firebase Admin SDK Service Agent account.\n    \n    * **Keys** -\u003e **ADD KEY** -\u003e **Create new key** -\u003e **Key type**: **JSON** -\u003e **CREATE**.\n    \n    * Download and save the created private key to your computer.\n\n* Go to **IAM \u0026 Admin** -\u003e **IAM** in [Google Cloud Platform](https://console.cloud.google.com/iam-admin/iam):\n\n    * Edit the Firebase Admin SDK Service Agent account.\n    \n    * **ADD ANOTHER ROLE** -\u003e **Role**: **Project** -\u003e **Editor** -\u003e **SAVE**.\n\n* Go to [API Library](https://console.developers.google.com/apis/library) -\u003e search for **Cloud Testing API** and **Cloud Tool Results API** -\u003e enable them.\n\nOnce finished setup, you can then launch a container to deploy UI tests to Firebase Test Lab:\n\n```bash\n# pull the image with Google Cloud SDK integrated\ndocker pull thyrlian/android-sdk-firebase-test-lab\n\n# spin up a container\n# don't forget to mount the previously created private key, assume it's saved as firebase.json\n# we'll persist all your gcloud configuration which would be created at ~/.config/gcloud/\n\n# spin up a container with interactive mode\ndocker run -it -v $(pwd)/sdk:/opt/android-sdk -v \u003cyour_private_key_dir\u003e/firebase.json:/root/firebase.json -v $(pwd)/gcloud-config:/root/.config/gcloud thyrlian/android-sdk-firebase-test-lab /bin/bash\n# or spin up a container with SSH\ndocker run -d -p 2222:22 -v $(pwd)/sdk:/opt/android-sdk -v \u003cyour_private_key_dir\u003e/firebase.json:/root/firebase.json -v $(pwd)/gcloud-config:/root/.config/gcloud -v $(pwd)/authorized_keys:/root/.ssh/authorized_keys thyrlian/android-sdk-firebase-test-lab\n\n# authorize access to Google Cloud Platform with a service account (by its private key)\ngcloud auth activate-service-account -q --key-file /root/firebase.json\n\n# list all Android models available for testing\ngcloud firebase test android models list\n\n# below are just some examples, to give you an idea how it looks like\n┌───────────────────┬────────────────────┬──────────────────────────────────────┬──────────┬─────────────┬─────────────────────────┬───────────────┐\n│      MODEL_ID     │        MAKE        │              MODEL_NAME              │   FORM   │  RESOLUTION │      OS_VERSION_IDS     │      TAGS     │\n├───────────────────┼────────────────────┼──────────────────────────────────────┼──────────┼─────────────┼─────────────────────────┼───────────────┤\n│ Nexus9            │ HTC                │ Nexus 9                              │ VIRTUAL  │ 2048 x 1536 │ 21,22,23,24,25          │               │\n│ NexusLowRes       │ Generic            │ Low-resolution MDPI phone            │ VIRTUAL  │  640 x 360  │ 23,24,25,26,27,28,29,30 │ beta=30       │\n│ OnePlus3T         │ OnePlus            │ OnePlus 3T                           │ PHYSICAL │ 1920 x 1080 │ 26                      │               │\n└───────────────────┴────────────────────┴──────────────────────────────────────┴──────────┴─────────────┴─────────────────────────┴───────────────┘\n\n# build both the app and the instrumented tests APKs\n\n# build the application APK\n./gradlew :\u003cyour_module\u003e:assemble\n# APK will be generated at: \u003cyour_module\u003e/build/outputs/apk/\u003cbuild_type\u003e\n\n# build the instrumented tests APK\n./gradlew :\u003cyour_module\u003e:assembleAndroidTest\n# APK will be generated at: \u003cyour_module\u003e/build/outputs/apk/androidTest/\u003cbuild_type\u003e\n\n# run UI tests\nUI_TEST_APK=\"--app=\u003cyour_apk_path\u003e/debug.apk --test=\u003cyour_apk_path\u003e/androidTest.apk\"\nUI_TEST_TYPE=\"instrumentation\"\nUI_TEST_DEVICES=\"--device model=MODEL_ID,version=OS_VERSION_IDS,locale=en,orientation=portrait\"\nUI_TEST_RESULT_DIR=\"build-result\"\nUI_TEST_PROJECT=\"\u003cyour_project_id\u003e\"\ngcloud firebase test android run $UI_TEST_APK $UI_TEST_DEVICES --type=$UI_TEST_TYPE --results-dir=$UI_TEST_RESULTS_DIR --project=$UI_TEST_PROJECT\n\n# it's capable of running in parallel on separate devices with a number of shards\n# if you want to evenly distribute test cases into a number of shards, specify the flag: --num-uniform-shards=int\n# e.g.: to run 20 tests in parallel on 4 devices (5 tests per device): --num-uniform-shards=4\n```\n\nLater you can view the test results (including the recorded video of test execution) in [Firebase Console](https://console.firebase.google.com), open your ***project***, navigate to **Test Lab**.\n\nTo learn more about Firebase Test Lab and Google Cloud SDK, please go and visit below links:\n\n* [Firebase Test Lab Overview](https://firebase.google.com/docs/test-lab/android/overview)\n\n* [Google Cloud SDK CLI Command Group for Android Application Testing](https://cloud.google.com/sdk/gcloud/reference/beta/firebase/test/android)\n\n## Android Commands Reference\n\n* Check installed Android SDK tools version\n\n  ```console\n  cat $ANDROID_HOME/cmdline-tools/tools/source.properties | grep Pkg.Revision\n  cat $ANDROID_HOME/platform-tools/source.properties | grep Pkg.Revision\n  ```\n\n  \u003e The \"`android`\" command is deprecated.  For command-line tools, use `cmdline-tools/tools/bin/sdkmanager` and `cmdline-tools/tools/bin/avdmanager`.\n\n* List installed and available packages\n\n  ```console\n  sdkmanager --list\n  # print full details instead of truncated path\n  sdkmanager --list --verbose\n  ```\n\n* Update all installed packages to the latest version\n\n  ```bash\n  sdkmanager --update\n  ```\n\n* Install packages\n\n  \u003e The packages argument is an SDK-style path as shown with the `--list` command, wrapped in quotes (for example, `\"extras;android;m2repository\"`). You can pass multiple package paths, separated with a space, but they must each be wrapped in their own set of quotes.\n\n  ```bash\n  sdkmanager \"extras;android;m2repository\" \"extras;google;m2repository\" \"extras;google;google_play_services\" \"extras;google;instantapps\" \"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2\" \"build-tools;26.0.0\" \"platforms;android-26\"\n  ```\n\n* Stop emulator\n\n  ```console\n  adb -s \u003cdevice_sn\u003e emu kill\n  ```\n\n## Demythologizing Memory\n\n### OOM behaviour\n\nSometimes you may encounter OOM (Out of Memory) issue.  The issues vary in logs, while you could find the essence by checking the exit code (`echo $?`).\n\nFor demonstration, below examples try to execute [MemoryFiller](https://github.com/thyrlian/AndroidSDK/blob/master/misc/MemoryFiller/MemoryFiller.java) which can fill memory up quickly.\n\n* **Exit Code** `137` (= 128 + 9 = SIGKILL = Killed)\n\n  Example code:\n  \n    ```bash\n    # spin up a container with memory limit (128MB)\n    docker run -it -m 128m -v $(pwd)/misc/MemoryFiller:/root/MemoryFiller thyrlian/android-sdk /bin/bash\n    # fill memory up\n    cd /root/MemoryFiller \u0026\u0026 javac MemoryFiller.java\n    java MemoryFiller\n    ```\n\n  Logs:\n  \n    ```console\n    Killed\n    ```\n\n  Commentary: The process was in extreme resource starvation, thus was killed by the kernel OOM killer.  This happens when **JVM max heap size \u003e actual container memory**.  Similarly, the logs could look like this when running a gradle task in an Android project: `Process 'Gradle Test Executor 1' finished with non-zero exit value 137`.\n\n* **Exit Code** `1` (= SIGHUP = Hangup)\n\n  Example code:\n  \n    ```bash\n    # spin up a container with memory limit (or without - both lead to the same result)\n    docker run -it -m 128m -v $(pwd)/misc/MemoryFiller:/root/MemoryFiller thyrlian/android-sdk /bin/bash\n    # fill memory up\n    # enable Docker memory limits transparency for JVM\n    cd /root/MemoryFiller \u0026\u0026 javac MemoryFiller.java\n    java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap MemoryFiller\n    ```\n\n  Logs:\n  \n    ```console\n    Exception in thread \"main\" java.lang.OutOfMemoryError: Java heap space at MemoryFiller.main(MemoryFiller.java:13)\n    ```\n\n  Commentary: With [enabling Docker memory limits transparency for JVM](https://blogs.oracle.com/java-platform-group/java-se-support-for-docker-cpu-and-memory-limits), JVM is able to correctly estimate the max heap size, and it won't be killed by the kernel OOM killer any more.  Similarly, the logs could look like this when running a gradle task in an Android project: `Process 'Gradle Test Executor 1' finished with non-zero exit value 1`.  In this case, you should either check your code or tweak your memory limit for container (or JVM heap parameters, or even the host memory size).\n\n* **Exit Code** `3` (= SIGQUIT = Quit)\n\n  Example code:\n  \n    ```bash\n    # spin up a container without memory limit\n    docker run -it -v $(pwd)/misc/MemoryFiller:/root/MemoryFiller thyrlian/android-sdk /bin/bash\n    # fill memory up\n    cd /root/MemoryFiller \u0026\u0026 javac MemoryFiller.java\n    # make sure that Docker memory resource is big enough \u003e JVM max heap size\n    # otherwise it's better to run with UnlockExperimentalVMOptions \u0026 UseCGroupMemoryLimitForHeap enabled\n    java -XX:+ExitOnOutOfMemoryError MemoryFiller\n    ```\n\n  Logs:\n  \n    ```console\n    Terminating due to java.lang.OutOfMemoryError: Java heap space\n    ```\n\n  Commentary: JRockit JVM exits on the first occurrence of an OOM error. It can be used if you prefer restarting an instance of JRockit JVM rather than handling OOM errors.\n\n* **Exit Code** `134` (= 128 + 6 = SIGABRT = Abort)\n\n  Example code:\n  \n    ```bash\n    # spin up a container without memory limit\n    docker run -it -v $(pwd)/misc/MemoryFiller:/root/MemoryFiller thyrlian/android-sdk /bin/bash\n    # fill memory up\n    cd /root/MemoryFiller \u0026\u0026 javac MemoryFiller.java\n    # make sure that Docker memory resource is big enough \u003e JVM max heap size\n    # otherwise it's better to run with UnlockExperimentalVMOptions \u0026 UseCGroupMemoryLimitForHeap enabled\n    java -XX:+CrashOnOutOfMemoryError MemoryFiller\n    ```\n\n  Logs:\n  \n    ```console\n    Aborting due to java.lang.OutOfMemoryError: Java heap space\n    #\n    # A fatal error has been detected by the Java Runtime Environment:\n    #\n    #  Internal Error (debug.cpp:308), pid=63, tid=0x00007f208708d700\n    #  fatal error: OutOfMemory encountered: Java heap space\n    #\n    # JRE version: OpenJDK Runtime Environment (8.0_131-b11) (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)\n    # Java VM: OpenJDK 64-Bit Server VM (25.131-b11 mixed mode linux-amd64 compressed oops)\n    # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again\n    #\n    # An error report file with more information is saved as:\n    # /root/MemoryFiller/hs_err_pid63.log\n    #\n    # If you would like to submit a bug report, please visit:\n    #   http://bugreport.java.com/bugreport/crash.jsp\n    #\n    Aborted\n    ```\n\n  Commentary: JRockit JVM crashes and produces text and binary crash files when an OOM error occurs.  When JVM crashes with a fatal error, an error report file `hs_err_pid***.log` will be generated in the same working directory.\n\n### Facts\n\n* JVM is not container aware, and always guesses about the memory resource (for JDK version earlier than 8u131 or 9).\n\n* Many tools (such as `free`, `vmstat`, `top`) were invented before the existence of [cgroups](https://en.wikipedia.org/wiki/Cgroups), thus they have no clue about the resources limits.\n\n* `-XX:MaxRAMFraction`: maximum fraction (1/n) of real memory used for maximum heap size (`-XX:MaxHeapSize` / `-Xmx`), the default value is 4.\n\n* `-XX:MaxMetaspaceSize`: where class metadata reside.  `-XX:MaxPermSize` is deprecated in JDK 8.  It used to be Permanent Generation space before JDK 8, which could cause `java.lang.OutOfMemoryError: PermGen` problem.\n\n* `-XshowSettings:category`: shows settings and continues. Possible category arguments for this option include the following: `all` (all categories of settings, the default value), `locale` (settings related to locale), `properties` (settings related to system properties), `vm` (settings of the JVM).  To get JVM Max Heap Size, simply run `java -XshowSettings:vm -version`\n\n* `-XX:+PrintFlagsFinal`: print all VM flags after argument and ergonomic processing.  You can run `java -XX:+PrintFlagsFinal -version` to get all information.\n\n* By default, [Android Gradle Plugin](https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.DexOptions.html) sets the maxProcessCount to 4 (the maximum number of concurrent processes that can be used to dex).  `Total Memory = maxProcessCount * javaMaxHeapSize`\n\n* Earlier in JDK 8, you need to set the environment variable `_JAVA_OPTIONS` to `-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap`.  Then you'll see such logs like `Picked up _JAVA_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap` during any task execution, which means it takes effect.  JDK 10 has introduced `-XX:+UseContainerSupport` which is enabled by default to improve the execution and configurability of Java running in Docker containers.  Since JDK 1.8.0_191, `-XX:+UseContainerSupport` was also backported, then you don't need to set `-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap` any more.  `UseCGroupMemoryLimitForHeap` was deprecated in JDK 10 and removed in JDK 11.\n\n* `JAVA_OPTS` environment variable won't be used by JVM directly, but sometimes get recognized by other apps (e.g. Apache Tomcat) as configuration.  If you want to use it for any Java executable, do it like this: `java $JAVA_OPTS ...`\n\n* The official `JAVA_TOOL_OPTIONS` environment variable is provided to augment a command line, so that command line options can be passed without accessing or modifying the launch command.  It is recognized by all VMs.\n\n* You can tweak `-Xms` or `-Xmx` on your own to specify the initial or maximum heap size.\n\n## Docker Config\n\n### How to enable the remote API (for CI purpose)\n\n```bash\n# on macOS\nbrew install socat\nsocat TCP-LISTEN:2376,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock\n\n#====================================================================================================#\n\n# on Linux (Debian / Ubuntu)\n# changing DOCKER_OPTS is optional\n# Use DOCKER_OPTS to modify the daemon startup options\n# echo -e '\\nDOCKER_OPTS=\"-H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock\"\\n' | sudo tee --append /etc/default/docker \u003e /dev/null\n\n# find the location of systemd unit file\nsystemctl status docker\n#=\u003e docker.service - Docker Application Container Engine\n#=\u003e Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)\n\nsudo sed -i.bak 's?ExecStart.*?ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock?g' /lib/systemd/system/docker.service\nsudo systemctl daemon-reload\nsudo systemctl restart docker.service\n\n# check if the port is listened or not\nsudo netstat -tulpn | grep LISTEN\n```\n\n## Release guide\n\n* Go to the top-level directory of this project\n\n* Execute [`image-publisher.sh`](https://github.com/thyrlian/AndroidSDK/blob/master/image-publisher.sh) script\n\n  ```console\n  ./image-publisher.sh [TAG]\n  ```\n\n* Execute [`version-inspector.sh`](https://github.com/thyrlian/AndroidSDK/blob/master/android-sdk/version-inspector.sh) script inside a docker container from local machine to check versions of tools\n\n  ```console\n  cmd=$(cat ./android-sdk/version-inspector.sh) \u0026\u0026 docker run -it --rm android-sdk bash -c \"$cmd\"\n  ```\n\n* Update [Changelog](https://github.com/thyrlian/AndroidSDK/blob/master/CHANGELOG.md) based on the versions info printed by the above commands\n\n* Create a new tag (name it the version number, just like: `x.x`) with the corresponding commit in Git and publish the tag\n\n## Contributing\n\nYour contribution is always welcome, which will for sure make the Android SDK Docker solution better.  Please check the [contributing guide](./CONTRIBUTING.md) to get started!  Thank you ☺\n\n## Changelog\n\nSee [here](https://github.com/thyrlian/AndroidSDK/blob/master/CHANGELOG.md).\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/thyrlian/AndroidSDK.svg)](https://starchart.cc/thyrlian/AndroidSDK)\n\n## License\n\nCopyright © 2016-2024 Jing Li. It is released under the [Apache License](https://www.apache.org/licenses/LICENSE-2.0). See the [LICENSE](https://raw.githubusercontent.com/thyrlian/AndroidSDK/master/LICENSE) file for details.\n\nBy continuing to use this Docker Image, you accept the terms in below license agreement.\n\n* [Android Software Development Kit License Agreement](https://raw.githubusercontent.com/thyrlian/AndroidSDK/master/EULA/AndroidSoftwareDevelopmentKitLicenseAgreement-20210727) (or read it [here](https://developer.android.com/studio/terms))\n\n* [Android SDK Preview License Agreement](https://raw.githubusercontent.com/thyrlian/AndroidSDK/master/EULA/AndroidSDKPreviewLicenseAgreement)\n\n* [Intel Android Extra License](https://raw.githubusercontent.com/thyrlian/AndroidSDK/master/EULA/IntelAndroidExtraLicense)\n","funding_links":["https://ko-fi.com/thyrlian","https://patreon.com/thyrlian"],"categories":["Dockerfile","Shell","kotlin"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthyrlian%2FAndroidSDK","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthyrlian%2FAndroidSDK","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthyrlian%2FAndroidSDK/lists"}