### Description
Gmsaas had a major update in 1.15.0 which addresses adb connection
issues (OpenSSL 3 is now used for ADB Tunnel instead of OpenSSL 1.1.1).
As described in #511, Genymotion has deprecated credential based
login. This adds support for passing in an auth token instead.
This could also check for the GENYMOTION_API_TOKEN env variable being
set and skipping the login entirely, but I haven't added that in favor
of keeping the explicit token check during login.
This also updates the default version of the gmsaas package to the
latest release.
**Please make sure that it is an issue / a feature request. If it is a question / help wanted, please visit [our group chat](https://gitter.im/butomo1989/docker-android). Thank you!**
Operating System:
<!-- OSX Yosemite, Ubuntu 16.04, Windows 10 etc -->
This program is subject to the terms of the Apache License, Version 2.0 AND the following amendments on forks and data processing. Thus, this is a Custom Apache 2.0 License, NOT a dual-license model you may choose from.
You can obtain a copy of the license at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
## Forks
Additionally to Apache-2.0, when you fork this repo you are required to either remove our Google Form ID: 1FAIpQLSdrKWQdMh6Nt8v8NQdYvTIntohebAgqWCpXT3T9NofAoxcpkw or stop usage gathering completely.
## Data processing agreement
By using this software you agree that the following non-PII (non personally identifiable information) data will be collected, processed and used by the maintainers for the purpose of improving the docker-android project.
By using this software you also grant us a nonexclusive, irrevocable, world-wide, perpetual royalty-free permission to use, modify and publish these data for all purposes, internally or publicly, including the right to sub-license said permission rights.
We collect, process and use the following data:
* Date and time when Docker-Android started
* User (it will collect the information about Release Version of Machine), e.g. Linux-5.4.0-146-generic-x86_64-with-glibc2.29_#163-Ubuntu_SMP_Fri_Mar_17_18:26:02_UTC_2023. This does not allow us to track individual users but does enable us to accurately measure user counts
* City (the information come from https://ipinfo.io)
* Region (the information come from https://ipinfo.io)
* Country (the information come from https://ipinfo.io)
* Release version of Docker-Android
* Appium (Whether user use Appium or not - The possible value will be "true" or "false")
* Appium Additional Arguments
* Web-Log (Whether user use Web-Log feature or not - The possible value will be "true" or "false")
* Web-Vnc (Whether user use Web-Vnc feature or not - The possible value will be "true" or "false")
* Screen-Resolution
* Device Type (Which docker image is used - The possible value will be "emulator" or "geny_cloud" or "geny_aws")
* Emulator Device (Which device profile and skin is used if the user use device_type "emulator")
* Emulator Android Version (Which Android version is used if the user use device_type "emulator"
* Emulator No-Skin feature (Whether user use no-skin feature or not - The possible value will be "true" or "false")
* Emulator Data Partition
* Emulator Additional Arguments
## End of License Information
More information about anonymized data collection can be seen [here](./documentations/USER_BEHAVIOR_ANALYTICS.md)
[](https://gitter.im/butomo1989/docker-android?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](http://paypal.me/budtmo) [](http://makeapullrequest.com) [](https://codecov.io/gh/budtmo/docker-android) [](https://gitter.im/budtmo/docker-android?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://github.com/budtmo/docker-android/releases)
Purposes
--------
Docker-Android is a docker image built to be used for everything related to Android. It can be used for Application development and testing (native, web and hybrid-app).
1. Run UI tests for mobile websites with [appium]
2. Build Android project and run unit tests with the latest build-tools
3. Run UI tests for Android applications with different frameworks ([appium], [espresso], [robotium], etc.)
4. Run monkey / stress tests
5. SMS testing
Advantages compare with other docker-android projects
1. noVNC to see what happen inside docker container
2. Emulator for different devices / skins, such as Samsung Galaxy S6, LG Nexus 4, HTC Nexus One and more.
3. Ability to connect to Selenium Grid
Advantages of using this project
--------------------------------
1. Emulator with different device profile and skins, such as Samsung Galaxy S6, LG Nexus 4, HTC Nexus One and more.
2. Support vnc to be able to see what happen inside docker container
3. Support log sharing feature where all logs can be accessed from web-UI
4. Ability to control emulator from outside container by using adb connect
5.Support real devices with screen mirroring
6.Ability to record video during test execution for debugging
7. Integrated with other cloud solutions, e.g. [Genymotion Cloud](https://www.genymotion.com/cloud/)
8. Open source with more features coming
5.Integrated with other cloud solutions, e.g. [Genymotion Cloud](https://www.genymotion.com/cloud/)
6.It can be used to build Android project
7. It can be used to run unit and UI-Test with different test-frameworks, e.g. Appium, Espresso, etc.
List of Docker images
List of Docker-Images
---------------------
|OS |Android |API |Browser |Browser version |Chromedriver |Image |Size |
|:---|:---|:---|:---|:---|:---|:---|:---|
|Linux|5.0.1|21|browser|37.0|2.21|butomo1989/docker-android-x86-5.0.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.0.1 "Get your own image badge on microbadger.com")|
|Linux|5.1.1|22|browser|39.0|2.13|butomo1989/docker-android-x86-5.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.1.1 "Get your own image badge on microbadger.com")|
|Linux|6.0|23|browser|44.0|2.18|butomo1989/docker-android-x86-6.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-6.0 "Get your own image badge on microbadger.com")|
|Linux|7.0|24|chrome|51.0|2.23|butomo1989/docker-android-x86-7.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.0 "Get your own image badge on microbadger.com")|
|Linux|7.1.1|25|chrome|55.0|2.28|butomo1989/docker-android-x86-7.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.1.1 "Get your own image badge on microbadger.com")|
|Linux|8.0|26|chrome|58.0|2.31|butomo1989/docker-android-x86-8.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-8.0 "Get your own image badge on microbadger.com")|
|Linux|8.1|27|chrome|61.0|2.33|butomo1989/docker-android-x86-8.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-8.1 "Get your own image badge on microbadger.com")|
|All |-|-|-|-|-|butomo1989/docker-android-real-device|[](https://microbadger.com/images/butomo1989/docker-android-real-device "Get your own image badge on microbadger.com")|
|Linux|All|All|All|All|All|butomo1989/docker-android-genymotion|[](https://microbadger.com/images/butomo1989/docker-android-genymotion "Get your own image badge on microbadger.com")|
|Android |API |Image with latest release version |Image with specific release version|
1.If you use ***Ubuntu OS*** on your host machine, you can skip this step. For ***OSX*** and ***Windows OS*** user, you need to use Virtual Machine that support Virtualization with Ubuntu OS because the image can be run under ***Ubuntu OS only***.
- For ***Linux OS***, please use image name that contains "x86"
- For ***OSX*** and ***Windows OS***, please use Virtual Machine that support Virtualization with Ubuntu OS
2. Verify the ip address of docker host.
- For OSX, you can find out by using following command:
```bash
docker-machine ip default
```
- For different OS, localhost should work.
3. Open ***http://docker-host-ip-address:6080*** from web browser.
Custom configurations
---------------------
[This document](README_CUSTOM_CONFIG.md) contains custom configurations of Docker-Android that you might need, e.g. Proxy, Changing language on fly, etc.
Build Android project
---------------------
Docker-Android can be used for building Android project and executing its unit test. This following steps will illustrate how to build Android project:
1. Clone [this sample test project](https://github.com/googlesamples/android-testing).
The default behaviour is to destroy the emulated device on container restart. To persist data, you need to mount a volume at `/home/androidusr`:
```
docker run -v data:/home/androidusr budtmo/docker-android:emulator_11.0
```
![][adb_connection]
WSL2 Hardware acceleration (Windows 11 only)
-----------
**Note:** You need to have Android Debug Bridge (adb) installed in your host machine.
Credit goes to [Guillaume - The Parallel Interface blog](https://www.paralint.com/2022/11/find-new-modified-and-unversioned-subversion-files-on-windows)
SMS Simulation
--------------
[Microsoft - Advanced settings configuration in WSL](https://learn.microsoft.com/en-us/windows/wsl/wsl-config)
Then, using PowerShell, open a notepad on `notepad $env:USERPROFILE\.wslconfig`. Inside, put these other flags:
```
[wsl2]
nestedVirtualization=true
```
- Login with given auth_token from 1.step
4. Restart WSL2 via CMD prompt or Powershell
```
wsl --shutdown
```
```bash
auth <auth_token>
```
- Send the sms
`command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm'` sets `/dev/kvm` to `kvm` usergroup rather than the default `root` usergroup on WSL2 startup.
```bash
sms send <phone_number> <message>
```
`nestedVirtualization` flag is only available to Windows 11.
2. Using adb
If this setup does not work, you may have an old WSL version. In that case, ignore `\.wslconfig` and put everything on `/etc/wsl.conf`, including the `[wsl2]` flag.
6. [Deploying on cloud (Azure, AWS, GCP)](./documentations/USE_CASE_CLOUD.md)
![][sms]
Custom-Configurations
---------------------
Google Play Services and Google Play Store
------------------------------------------
Docker-Android contains Google Play Service (v12.8.74) and Google Play Store (v11.0.50). Both applications are downloaded from [apklinker](https://www.apklinker.com/), so please be aware of it in case you use private/company account to that applications.
VMWARE
------
This [document](README_VMWARE.md) shows you how to configure Virtual Machine on VMWARE to be able to run Docker-Android.
Cloud
-----
This [document](README_CLOUD.md) contains information about deploying Docker-Android on cloud services.
This [document](./documentations/CUSTOM_CONFIGURATIONS.md) contains information about configurations that can be used to enable some features, e.g. log-sharing, etc.
For you who do not have ressources to maintain the simulator or to buy machines or need different device profiles, you need to give a try to [Genymotion Cloud](https://www.genymotion.com/cloud/). Docker-Android is integrated with Genymotion on different cloud services, e.g. Genymotion Cloud, AWS, GCP, Alibaba Cloud. Please follow [this document](README_GENYMOTION.md) for more detail.
For you who do not have ressources to maintain the simulator or to buy machines or need different device profiles, you can give a try by using [Genymotion SAAS](https://cloud.geny.io/). Docker-Android is [integrated with Genymotion](https://www.genymotion.com/blog/partner_tag/docker/) on different cloud services, e.g. Genymotion SAAS, AWS, GCP, Alibaba Cloud. Please follow [this document](./documentations/THIRD_PARTY_GENYMOTION.md) for more detail.
Troubleshooting
---------------
All logs inside container are stored under folder **/var/log/supervisor**. you can print out log file by using **docker exec**. Example:
The Emulator skins are taken from [Android Studio IDE](https://developer.android.com/studio) and [Samsung Developer Website](https://developer.samsung.com/)
Due to high requests for help and to be able to actively maintain the projects, the creator has decided to create docker-android-pro. Docker-Android-Pro is a sponsor based project which mean that the docker image of pro-version can be pulled only by [active sponsor](https://github.com/sponsors/budtmo).
The differences between normal version and pro version are:
|Feature |Normal |Pro |Comment|
|:---|:---|:---|:---|
|user-behavior-analytics|Yes|No|-|
|proxy|No|Yes|Set up company proxy on Android emulator on fly|
|language|No|Yes|Set up language on Android emulator on fly|
|Newer Android version|No|Yes|Support other newer Android version e.g. Android 15, Android 16, etc|
|root-privileged|No|Yes|Able to run command with security privileged|
|headless-mode|No|Yes|Save resources by using headless mode|
|Selenium 4.x integration|No|Yes|Running Appium UI-Tests againt one (Selenium Hub) endpoint for Android- and iOS emulator(s) / device(s)|
|multiple Android-Simulators|No|Yes (soon)|Save resources by having multiple Android-Simulators on one docker-container|
|Google Play Store|No|Yes (soon)|-|
|Video Recording|No|Yes (soon)|Helpful for debugging|
This [document](./documentations/DOCKER-ANDROID-PRO.md) contains detail information about how to use docker-android-pro.
Appium is automation test framework to test mobile website and mobile application, including Android. To be able to use Appium, you need to run appium-server. You run Appium-Server inside docker-android container by ***opening port 4723*** and ***passing an environment variable APPIUM=true***.
You can deactivate auto_record by changing the value to "False" in docker-compose file. e.g. change value to "False" in this [line](docker-compose.yml#L70).
### Relaxed Security
Pass environment variable RELAXED_SECURITY=true to disable additional security check to use some advanced features.
### Docker-Compose
![][compose]
There is [example of compose file](docker-compose.yml) to run complete selenium grid and docker-android container as nodes. [docker-compose](https://docs.docker.com/compose/install/) version [1.13.0](https://github.com/docker/compose/releases/tag/1.13.0) or higher is required to be able to execute that compose file.
For the first run, this will create a new avd and all the changes will be accessible in the `local_backup` directory. Now for all future runs, it will reuse the avds. Even this should work with new releases of `docker-android`
You can easily scale your Appium tests on Genymotion Android virtual devices in the cloud. They are available on SaaS or as virtual images on AWS, GCP or Alibaba Cloud.
1. On SaaS <br />
Use [device.json](genymotion/example/sample_devices/devices.json) to define the device to start. You can specify the port on which the device will start so you don't need to change the device name in your tests every time you need to run those tests. Then run following command
The following instructions are used for OS X. You'll need [docker-machine-parallels](https://github.com/Parallels/docker-machine-parallels) to create a virtual machine (vm) with tiny core linux for running docker images. After that, you may start the vm you created for VMWare Fusion or Parallels Desktop and run a docker container inside this vm. If you're going to use the android docker of emulator with x86 processor, setup this vm for nested virtualization and kvm support before you run a docker container.
1. Install docker-machine-parallels via Homebrew:
```bash
$ brew install docker-machine-parallels
```
2. Create a virtual machine for running docker images based on the virtual machine tool you use
This utility `docker-machine-parallels` will fetch boot2docker.iso to create a vm of VMWare fusion or Parallels Desktop. When the vm is created, you'll see it's booted with VMWare fusion or Parallels Desktop where the network of vm is set to NAT and one IP is assigned. You'll be able to connect to vnc service inside the docker image through that IP. Say it's `10.211.55.3` and we'll use it later.
3. Setup the virtual machine for nested virtualization support
3.1. Shutdown the vm by running the command below in the boot2docker vm before you setup it.
```bash
# shutdown -h now
```
If you use VMWare Fusion, go to menu bar > Vitual Machine > Settings > Processors and Memory, expand Advanced options, and select `Enable hypervisor applications in this virtual machine`.

If you use Parallels Desktop, open settings screen of that vm and go to `CPU & Memory` under `hardware` tab, expand Advanced settings and select `Enable nested virtualization`.

4. Enable kvm inside virtual machine
4.1. Run as an account other than root to install kvm packages using tce-load.
```bash
# su docker
$ tce-load -wi kvm
```
4.2. Run as root to load kvm module after kvm packages install.
```bash
$ sudo modprobe kvm_intel
```
4.3. Check if the kvm device is loaded.
```bash
$ ls /dev/kvm
```
4.4. Check if your CPU supports hardware virtualization now
```bash
$ egrep -c '(vmx|svm)' /proc/cpuinfo
```
If **0** it means that your CPU doesn't support hardware virtualization.
If **1** or more it does - but you still need to make sure that virtualization is enabled in the BIOS.
5. You may now run a docker container
5.1. Let's run a docker image for an emulator with x86 processor.
When the services inside this docker container are running, connect to http://10.211.55.3:6080/vnc.html (the IP we got when the docker machine was created) and login. The emulator with x86 processor should be running on screen.
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.