Giter Site home page Giter Site logo

android-emulator-container-scripts's Introduction

Android Emulator Container Scripts

This is a set of minimal scripts to run the emulator in a container for various systems such as Docker, for external consumption. The scripts are compatible with both Python version 2 and 3.

*Note that this is still an experimental feature and we recommend installing this tool in a python virtual environment. Please file issues if you notice that anything is not working as expected.

Requirements

These demos are intended to be run on a linux OS. Your system must meet the following requirements:

  • A Python interpreter must be installed (python3 with python3-venv to create virtual environments)

  • ADB must be available on the path. ADB comes as part of th Android SDK. Note that installing the command line tools is sufficient.

  • Docker must be installed. Make sure you can run it as non-root user

  • Docker-compose must be installed.

  • KVM must be available. You can get access to KVM by running on "bare metal", or on a (virtual) machine that provides nested virtualization. If you are planning to run this in the cloud (gce/azure/aws/etc..) you first must make sure you have access to KVM. Details on how to get access to KVM on the various cloud providers can be found here:

    • AWS provides bare metal instances that provide access to KVM.
    • Azure: Follow these instructions to enable nested virtualization.
    • GCE: Follow these instructions to enable nested virtualization.

Keep in mind that you will see reduced performance if you are making use of nested virtualization. The containers have been tested under Debian and Ubuntu running kernel 5.2.17.

NOTE: The images will not run in docker on mac or windows

Quick start with hosted containers.

We now host a set of containers in a public repository. You can find details about the containers here. You can now run these containers without building them. For example:

docker run \
  -e ADBKEY="$(cat ~/.android/adbkey)" \
  --device /dev/kvm \
  --publish 8554:8554/tcp \
  --publish 5555:5555/tcp  \
  us-docker.pkg.dev/android-emulator-268719/images/30-google-x64:30.1.2

This will pull down the container if it is not locally available and launch it. You can see that is starting:

After this you can connect to the device by configuring adb:

  adb connect localhost:5555

The device should now show up after a while as:

$ adb devices

List of devices attached
localhost:5555 device

If you wish to use this in a script you could do the following:

docker run -d \
  -e ADBKEY="$(cat ~/.android/adbkey)" \
  --device /dev/kvm \
  --publish 8554:8554/tcp \
  --publish 5555:5555/tcp  \
  us-docker.pkg.dev/android-emulator-268719/images/30-google-x64:30.1.2
  adb connect localhost:5555
  adb wait-for-device

  # The device is now booting, or close to be booted

A more detailed script can be found in run-in-script-example.sh.

Install in a virtual environment

You can install the python package as follows:

source ./configure.sh

This will activate a virtual environment and make the executable emu-docker available. You can get detailed information about the usage by launching it as follows:

emu-docker -h

You will have to accept the license agreements before you can create docker containers.

Quick start, interactively creating and running a docker image

You can interactively select which version of android and emulator you wish to use by running:

emu-docker interactive --start

You will be asked to select a system image and an emulator version, after which a docker file will be created. The system image and emulator will be downloaded to the current directory if needed. The script will provide you with a command to see the logs as well as the command to stop the container.

If the local adb server detected the started container automatically, you have nothing to do to query it through adb. If that's not the case, you can now connect to the running device using adb:

adb connect localhost:5555

To check if adb has seen the container, you can use the:

adb devices

command and check if a device is detected.

Do not forget to stop the docker container once you are done!

Read the section on making the emulator available on the web to run the emulator using webrtc

Obtaining URLs for emulator/system image zip files

Issuing:

emu-docker list

will query the currently published Android SDK and output URLs for the zip files of:

  • Available and currently Docker-compatible system images
  • Currently published and advertised emulator binaries

For each system image, the API level, variant, ABI, and URL are displayed. For each emulator, the update channel (stable vs canary), version, host os, and URL are displayed.

Example output:

SYSIMG android 21 L x86_64 https://dl.google.com/android/repository/sys-img/android/x86_64-21_r05.zip
SYSIMG android 22 L x86_64 https://dl.google.com/android/repository/sys-img/android/x86_64-22_r06.zip
SYSIMG android 23 M x86_64 https://dl.google.com/android/repository/sys-img/android/x86_64-23_r10.zip
SYSIMG android 24 N x86_64 https://dl.google.com/android/repository/sys-img/android/x86_64-24_r08.zip
SYSIMG android 25 N x86_64 https://dl.google.com/android/repository/sys-img/android/x86_64-25_r01.zip
SYSIMG android 26 O x86_64 https://dl.google.com/android/repository/sys-img/android/x86_64-26_r01.zip
SYSIMG android 27 O x86_64 https://dl.google.com/android/repository/sys-img/android/x86_64-27_r01.zip
SYSIMG android 28 P x86_64 https://dl.google.com/android/repository/sys-img/android/x86_64-28_r04.zip
SYSIMG android 28 Q x86_64 https://dl.google.com/android/repository/sys-img/android/x86_64-Q_r04.zip
SYSIMG google_apis 21 L x86_64 https://dl.google.com/android/repository/sys-img/google_apis/x86_64-21_r30.zip
SYSIMG google_apis 22 L x86_64 https://dl.google.com/android/repository/sys-img/google_apis/x86_64-22_r24.zip
SYSIMG google_apis 23 M x86_64 https://dl.google.com/android/repository/sys-img/google_apis/x86_64-23_r31.zip
SYSIMG google_apis 24 N x86_64 https://dl.google.com/android/repository/sys-img/google_apis/x86_64-24_r25.zip
SYSIMG google_apis 25 N x86_64 https://dl.google.com/android/repository/sys-img/google_apis/x86_64-25_r16.zip
SYSIMG google_apis 26 O x86_64 https://dl.google.com/android/repository/sys-img/google_apis/x86_64-26_r13.zip
SYSIMG google_apis 28 P x86_64 https://dl.google.com/android/repository/sys-img/google_apis/x86_64-28_r09.zip
SYSIMG google_apis 28 Q x86_64 https://dl.google.com/android/repository/sys-img/google_apis/x86_64-Q_r04.zip
SYSIMG google_apis_playstore 28 P x86_64 https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86_64-28_r08.p
SYSIMG google_apis_playstore 28 Q x86_64 https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86_64-Q_r04.zp
EMU stable 29.0.11 windows https://dl.google.com/android/repository/emulator-windows-5598178.zip
EMU stable 29.0.11 macosx https://dl.google.com/android/repository/emulator-darwin-5598178.zip
EMU stable 29.0.11 linux https://dl.google.com/android/repository/emulator-linux-5598178.zip
EMU stable 28.0.25 windows https://dl.google.com/android/repository/emulator-windows-5395263.zip
EMU canary 29.0.12 windows https://dl.google.com/android/repository/emulator-windows-5613046.zip
EMU canary 29.0.12 macosx https://dl.google.com/android/repository/emulator-darwin-5613046.zip
EMU canary 29.0.12 linux https://dl.google.com/android/repository/emulator-linux-5613046.zip

One can then use tools like wget or a browser to download a desired emulator and system image. After the two are obtained, we can build a Docker image.

Given an emulator zip file and a system image zip file, we can build a directory that can be sent to docker build via the following invocation of emu-docker:

emu-docker create <emulator-zip> <system-image-zip>  [--dest docker-src-dir
(getcwd()/src by default)]

This places all the right elements to run a docker image, but does not build, run or publish yet. A Linux emulator zip file must be used.

Building the Docker image: Setting up the source dir

To build the Docker image corresponding to these emulators and system images:

docker build <docker-src-dir, either ./src or specified argument to
emu_docker.py>

A Docker image ID will output; save this image ID.

Running the Docker image

We currently assume that KVM will be used with docker in order to provide CPU virtualization capabilities to the resulting Docker image.

We provide the following run script:

./run.sh <docker-image-id> <additional-emulator-params>

It does the following:

docker run -e ADBKEY="$(cat ~/.android/adbkey)" \
--device /dev/kvm \
--publish 8554:8554/tcp \
--publish 5555:5555/tcp <docker-image-id>
  • Sets up the ADB key, assuming one exists at ~/.android/adbkey
  • Uses --device /dev/kvm to have CPU acceleration
  • Starts the emulator in the docker image with its gRPC service, forwarding the host ports 8554/5555 to container ports 8554/5555 respectively.
  • The gRPC service is used to communicate with the running emulator inside the container.

Note: You can use a public adbkey by injecting the ADBKEY_PUB variable, i.e.: -e ADBKEY_PUB="$(cat ~/.android/adbkey.pub)"

You also have the option to mount a /data partition which the emulator will use if available. This enables you to use a tmpfs which can give increased performance, especially in the nested virtualization scenario.

For example:

docker run -e ADBKEY="$(cat ~/.android/adbkey)" \
--device /dev/kvm \
--mount type=tmpfs,destination=/data \
--publish 8554:8554/tcp \
--publish 5555:5555/tcp <docker-image-id>

Running the Docker image with GPU acceleration

We currently only support hardware acceleration for NVIDIA. In order to make use of hardware acceleration you might have to install the NVIDIA docker extensions from here if you are running an older version of docker (<19.03). You must make sure you have a minimal X installation if you are using a cloud instance. For example Xvfb can be used. You must build the containers by passing in the --gpu flag:

emu-docker create stable Q --gpu

You can now launch the emulator with the run-with-gpu.sh script:

./run-with-gpu.sh <docker-image-id> <additional-emulator-params>

The script is similar as to the one described above with the addition that it will:

  • Make all the available gpu's available (--gpu all)
  • Opens up xhost access for the container
  • Enable the domain socket under /tmp/.X11-unix to communicate with hosts X server

Hardware acceleration will significantly improve performance of applications that heavily rely on graphics. Note that even though we need a X11 server for gpu acceleration there will be no ui displayed.

Pushing images to a repository

You can push the created images to a repository by providing the --push and --repo and --tag parameters when creating an image. The --tag parameter is optional and is used to indicate the version of the created image. This will default to the build-id of the emulator, as system images are rarely updated.

We adopted the following naming scheme for images:

{api}-{sort}-{abi}

Where:

  • api is the api level
  • sort is one of: aosp, google, playstore
    • aosp: A basic android open source image
    • google: A system image that includes access to Google Play services.
    • playstore: A system image that includes the Google Play Store app and access to Google Play services, including a Google Play tab in the Extended controls dialog that provides a convenient button for updating Google Play services on the device.
  • abi indicates the underlying CPU architecture, which is one of: x86, x86_64, a32, a64. Note that arm images are not hardware accelerated and might not be fast enough.

For example: 29-playstore-x86:30.1.2 indicates a playstore enabled system image with Q running on 32-bit x86.

An example invocation for publishing all Q images to google cloud repo could be:

    emu-docker -v create --push --repo us.gcr.io/emulator-project/ stable "Q"

Images that have been pushed to a repository can be launched directly from the repository. For example:

    docker run --device /dev/kvm --publish 8554:8554/tcp --publish 5555:5555/tcp \
    us.gcr.io/emulator-project/29-playstore-x86:30.1.2

Communicating with the emulator in the container

adb

We forward the port 5555 for adb access to the emulator running inside the container. Adb might not automatically detect the device, so run:

adb connect localhost:5555

Your device should now show up as:

$ adb devices

List of devices attached:
localhost:5555 device

Make the emulator accessible on the web

This repository also contains an example that demonstrates how you can use docker to make the emulator accessible through the web. This is done by composing the following set of docker containers:

  • Envoy, an edge and service proxy: The proxy is responsible for the following:
    • Offer TLS (https) using a self signed certificate
    • Redirect traffic on port 80 (http) to port 443 (https)
    • Act as a gRPC proxy for the emulator.
    • Verifying tokens to permit access to the emulator gRPC endpoint.
    • Redirect other requests to the Nginx component which hosts a React application.
  • Nginx, a webserver hosting a compiled React App
  • Firebase. We use firebase for authentication and authorization. Firebase will hand out JWT tokens that allow access to the emulator. If you use firebase you must configure your project properly!
  • The emulator with a gRPC endpoint and a WebRTC video bridge.

Important Notice!

In order to run this sample and be able to interact with the emulator you must keep the following in mind:

  • The demo has two methods to display the emulator.
    1. Create an image every second, which is displayed in the browser. This approach will always work, but gives poor performance.
    2. Use WebRTC to display the state of the emulator in real time. This will only work if you are able to create a peer to peer connection to the server hosting the emulator. This is usually not a problem when your server is publicly visible, or if you are running the emulator on your own intranet.

Requirements

  • You will need docker-compose.

  • You must have port 80 and 443 available. The docker containers will create an internal network and expose the http and https ports.

  • You will need to create an emulator docker image, as described in the documentation above.

  • Depending on your network you might need turn

  • We are currently using firebase to handle authentication and authorization. you will need to provide a JSON configuation of the project you wish to use. You can use the sample provided here, but it will only work on localhost. You can get the firebase configuration from the console Place the firebase josn configuration here:

    ./js/firebase_config.json

    This will be used to generate the configuration and envoy settings.

Running the emulator on the web

In order to create the web containers you must have the following tools available:

  • NodeJS
  • Npm

Next you must create a container with the emulator & system image version you wish to use. For example:

. ./configure.sh && emu-docker create canary "P.*x86_64"

Running the create script

Once you have taken care of the steps above you can create the containers using the create_web_container.sh script:

$ ./create_web_container.sh -h
   usage: create_web_container.sh [-h] [-a] [-s] [-i] -p user1,pass1,user2,pass2,...

   optional arguments:
   -h        show this help message and exit.
   -a        expose adb. Requires ~/.android/adbkey.pub to be available at run.
   -s        start the container after creation.
   -i        install systemd service, with definition in /opt/emulator

For example:

./create_web_container.sh

This will do the following:

  • Create a virtual environment
  • Create the set of containers to interact with the emulator.
  • Note that the systemd service has only been tested on debian/ubuntu.

You can now launch the container as follows:

docker-compose -f js/docker/docker-compose.yaml up

If you wish to make ADB available you can apply the overlay found in js/docker/development.yaml as follows:

docker-compose -f js/docker/docker-compose.yaml -f js/docker/development.yaml up

Point your browser to localhost. You will likely get a warning due to the usage of the self signed certificate. Once you accept the cert you should be able to login and start using the emulator.

Keep the following things in mind when you make the emulator accessible over adb:

  • Port 5555 will be exposed in the container.
  • The container must have access to the file: ~/.android/adbkey. This is the PRIVATE key used by adb. Without this you will not be able to access the device over adb.
  • The adb client you use to connect to the container must have access to the private key (~/.android/adbkey). This is usually the case if you are on the same machine.
  • You must run: adb connect ip-address-of-container:5555 before you can interact with the device. For example:
$ adb connect localhost:5555
$ adb shell getprop

Creating cloud instances

There is a sample cloud-init script that provides details on how you can configure an instance that will automatically launch and configure an emulator on creation. Details on how to do this can be found here.

Troubleshooting

We have a separate document related to dealing with issues.

Modifying the demo

Details on the design and how to modify the React application can be found here

android-emulator-container-scripts's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-emulator-container-scripts's Issues

The base containers versions should be set

I am trying to run the Android Emulator with your project. Unfortunately this does not work currently.

emulator_envoy | Proto constraint validation failed (Using deprecated option 'envoy.api.v2.route.CorsPolicy.allow_origin' from file route_components.proto. This configuration will be removed from Envoy soon. Please see https://www.envoyproxy.io/docs/envoy/latest/intro/deprecated for details. If continued use of this field is absolutely necessary, see https://www.envoyproxy.io/docs/envoy/latest/configuration/operations/runtime#using-runtime-overrides-for-deprecated-features for how to apply a temporary and highly discouraged override.): allow_origin: "*"
emulator_envoy | allow_methods: "GET, PUT, DELETE, POST, OPTIONS"
emulator_envoy | allow_headers: "keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout"
emulator_envoy | expose_headers: "custom-header-1,grpc-status,grpc-message"
emulator_envoy | max_age: "1728000"
emulator_envoy | 
emulator_envoy exited with code 1

Looks like some config options were deprecated. This is kind of normal in software development so using latest version of a base docker image is always highly discouraged as it can unexpectedly break the build without any changes in the code.

Please set versions to the working ones so that you are sure that the project is usable and will be in future. Then when new base images get released the versions may be updated in a form of a commit, after all the tests with the new versions pass.

[question] how Can it show emulator in web?

  1. ./run.sh 6a674e31b788 #image

start a emulator

  1. adb connect localhost:5555

connect

  1. flutter run

show ok

  1. docker-compose -f js/docker/docker-compose.yaml up

run a web

  1. touch localhost in web

However, I can find flutterApp in brower.
What's wrong with me?

"--privileged" is a bit of a hammer

Hi! This project is really cool, thanks for starting it! 🤘 ❤️

I was curious about the use of --privileged in

docker run -e "ADBKEY=$(cat ~/.android/adbkey)" --privileged --publish 5556:5556/tcp --publish 5555:5555/tcp $1
-- is that just to get /dev/kvm, or is there more than just KVM support which is necessary? From a security standpoint, it'd be really interesting if that could be condensed to the minimal set necessary. 😅

For example, I run a lot of QEMU containers with /dev/kvm using just --device /dev/kvm, so I'm guessing there's probably something more clever we could do to make that work without using --privileged (which removes a lot of the protections provided by using a container in the first place 😄).

Getting a black screen when using webrtc video

First of all thanks for open sourcing this. Great work.

I was able to set up the project and run it. But accessing video is not working, screenshotting works but as you mentioned it kills the performance. I am getting a black screen instead of video. No error/exception in browser console log or server log. Not sure what's going on. I am running on a GCE instance with public access.

Screen Shot 2019-10-29 at 1 55 44 AM

Emulator is stuck on the boot animation

I have a running emulator that is stuck at the boot screen, Im stuck with an endles out put of the following log messages:
0000000002 kernel: [ 330.027687] RBP: ffff9a59c11df2a0 R08: 0000000000000003 R09: ffff89d07b003800 kernel: [ 330.052439] R10: ffff89d078eeb300 R11: ffff9a59c11df398 R12: ffff9a59c11df300 kernel: [ 330.052439] R13: ffff89d07a5e5800 R14: ffff9a59c11df201 R15: 0000000000000002 kernel: [ 330.142708] FS: 0000000000000000(0000) GS:ffff89d07fd80000(006b) knlGS:00000000f782c494 kernel: [ 330.152733] CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 kernel: [ 330.152733] CR2: 00000000fff7b0fc CR3: 0000000133008000 CR4: 00000000000006a0 kernel: [ 330.213259] Call Trace: kernel: [ 330.213259] ? vp_notify+0x13/0x17 kernel: [ 330.213259] virtqueue_kick+0x22/0x35 kernel: [ 330.213259] virtnet_send_command+0xf3/0x165 kernel: [ 330.250870] virtnet_set_rx_mode+0xa9/0x364 kernel: [ 330.266688] ? __this_cpu_preempt_check+0x13/0x15 kernel: [ 330.286777] ? __local_bh_enable_ip+0x58/0x76 kernel: [ 330.286777] ? local_bh_enable+0x15/0x17 kernel: [ 330.295865] __dev_set_rx_mode+0x7c/0x81 kernel: [ 330.309102] __dev_open+0xdf/0x14a kernel: [ 330.313704] __dev_change_flags+0xad/0x1ce kernel: [ 330.313704] dev_change_flags+0x22/0x57 kernel: [ 330.351405] do_setlink+0x3b2/0xc4b kernel: [ 330.351405] rtnl_newlink+0x623/0x7e9 kernel: [ 330.388227] ? rtnl_newlink+0x131/0x7e9 kernel: [ 330.388227] ? constraint_expr_eval+0x230/0x4c6 kernel: [ 330.388227] ? selinux_capable+0x1e/0x20 kernel: [ 330.436923] ? security_capable+0x3d/0x56 kernel: [ 330.436923] ? ns_capable_common+0x2a/0x58 kernel: [ 330.477261] ? ns_capable+0xe/0x10 kernel: [ 330.477261] rtnetlink_rcv_msg+0x260/0x35a kernel: [ 330.485796] ? selinux_capable+0x1e/0x20 kernel: [ 330.495256] ? netdev_run_todo+0x5d/0x2dd kernel: [ 330.544774] ? ns_capable_common+0x2a/0x58 kernel: [ 330.544774] ? ns_capable+0xe/0x10 kernel: [ 330.561064] ? avc_has_perm+0x89/0x153 kernel: [ 330.561064] ? rtnetlink_bind+0x29/0x29 kernel: [ 330.595316] netlink_rcv_skb+0x7e/0xf7 kernel: [ 330.595316] rtnetlink_rcv+0x10/0x12 kernel: [ 330.602731] netlink_unicast+0x157/0x1e0 kernel: [ 330.602731] netlink_sendmsg+0x354/0x39b kernel: [ 330.633610] sock_sendmsg+0x2d/0x3d kernel: [ 330.633610] ___sys_sendmsg+0x1be/0x25c kernel: [ 330.633610] ? sock_destroy_inode+0x2e/0x31 kernel: [ 330.664827] ? evict+0x16f/0x184 kernel: [ 330.664827] ? __this_cpu_preempt_check+0x13/0x15 kernel: [ 330.686928] ? mem_cgroup_event_ratelimit+0x39/0x9c kernel: [ 330.693701] ? debug_smp_processor_id+0x17/0x19 kernel: [ 330.713638] ? __lru_cache_add+0x82/0x9a kernel: [ 330.713638] ? lru_cache_add_active_or_unevictable+0x49/0xba kernel: [ 330.766162] ? _raw_spin_unlock+0x15/0x2a kernel: [ 330.766162] __sys_sendmsg+0x4d/0x8a kernel: [ 330.766162] compat_SyS_sendmsg+0xf/0x11 kernel: [ 330.792805] compat_SyS_socketcall+0x1e8/0x249 kernel: [ 330.802261] ? page_fault+0x2f/0x50 kernel: [ 330.827916] do_fast_syscall_32+0x9e/0xf6 kernel: [ 330.827916] entry_SYSENTER_compat+0x7f/0x8e kernel: [ 330.827916] RIP: 0023:0xf797bad9 kernel: [ 330.843117] RSP: 002b:00000000fff7b0d0 EFLAGS: 00200286 ORIG_RAX: 0000000000000066 kernel: [ 330.875074] RAX: ffffffffffffffda RBX: 0000000000000010 RCX: 00000000fff7b0f0 kernel: [ 330.893801] RDX: 00000000fff83148 RSI: 0000000057296070 RDI: 00000000fff831e8 kernel: [ 330.907002] RBP: 00000000fff83168 R08: 0000000000000000 R09: 0000000000000000 kernel: [ 330.927084] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 kernel: [ 330.957693] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 kernel: [ 330.965052] Code: 01 00 01 00 72 07 0f b7 d6 89 f8 ee c3 55 48 89 e5 48 89 f7 48 c7 c6 89 f9 8b b7 e8 c8 fe ff ff 5d c3 48 81 fe 00 00 04 00 72 04 <66> 89 3e c3 48 81 fe 01 00 01 00 72 08 0f b7 d6 89 f8 66 ef c3 kernel: [ 333.170300] healthd: battery l=100 v=5000 t=25.0 h=2 st=2 c=900 fc=300000 cc=10 chg=a kernel: [ 357.883278] watchdog: BUG: soft lockup - CPU#3 stuck for 23s! [ip:1835] kernel: [ 357.883278] Modules linked in: kernel: [ 357.903964] CPU: 3 PID: 1835 Comm: ip Tainted: G L 4.14.112+ #1 kernel: [ 357.915650] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org 04/01/2014 kernel: [ 357.937638] task: 000000005c3e66ae task.stack: 000000005b83e08c kernel: [ 358.007255] RIP: 0010:iowrite16+0x9/0x33 kernel: [ 358.012751] RSP: 0018:ffff9a59c11df298 EFLAGS: 00210282 ORIG_RAX: ffffffffffffff10 kernel: [ 358.029704] RAX: 0000000000000002 RBX: ffff89d079a3b800 RCX: 0000000000000001 kernel: [ 358.051786] RDX: 00000000ffffffff RSI: ffff9a59c0145008 RDI: 0000000000000002 kernel: [ 358.051786] RBP: ffff9a59c11df2a0 R08: 0000000000000003 R09: ffff89d07b003800 kernel: [ 358.086856] R10: ffff89d078eeb300 R11: ffff9a59c11df398 R12: ffff9a59c11df300 kernel: [ 358.101066] R13: ffff89d07a5e5800 R14: ffff9a59c11df201 R15: 0000000000000002 kernel: [ 358.122691] FS: 0000000000000000(0000) GS:ffff89d07fd80000(006b) knlGS:00000000f782c494 kernel: [ 358.156319] CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 kernel: [ 358.156319] CR2: 00000000fff7b0fc CR3: 0000000133008000 CR4: 00000000000006a0 kernel: [ 358.179137] Call Trace: kernel: [ 358.179137] ? vp_notify+0x13/0x17 kernel: [ 358.205771] virtqueue_kick+0x22/0x35 kernel: [ 358.205771] virtnet_send_command+0xf3/0x165 kernel: [ 358.205771] virtnet_set_rx_mode+0xa9/0x364 kernel: [ 358.205771] ? __this_cpu_preempt_check+0x13/0x15 kernel: [ 358.205771] ? __local_bh_enable_ip+0x58/0x76 kernel: [ 358.280505] ? local_bh_enable+0x15/0x17 kernel: [ 358.301796] __dev_set_rx_mode+0x7c/0x81 kernel: [ 358.314832] __dev_open+0xdf/0x14a kernel: [ 358.314832] __dev_change_flags+0xad/0x1ce kernel: [ 358.352652] dev_change_flags+0x22/0x57 kernel: [ 358.352652] do_setlink+0x3b2/0xc4b kernel: [ 358.370622] rtnl_newlink+0x623/0x7e9 kernel: [ 358.370622] ? rtnl_newlink+0x131/0x7e9 kernel: [ 358.414222] ? constraint_expr_eval+0x230/0x4c6 kernel: [ 358.414222] ? selinux_capable+0x1e/0x20 kernel: [ 358.435066] ? security_capable+0x3d/0x56 kernel: [ 358.441752] ? ns_capable_common+0x2a/0x58 kernel: [ 358.470925] ? ns_capable+0xe/0x10 kernel: [ 358.477068] rtnetlink_rcv_msg+0x260/0x35a kernel: [ 358.477068] ? selinux_capable+0x1e/0x20 kernel: [ 358.493701] ? netdev_run_todo+0x5d/0x2dd kernel: [ 358.516854] ? ns_capable_common+0x2a/0x58 kernel: [ 358.516854] ? ns_capable+0xe/0x10 kernel: [ 358.523680] ? avc_has_perm+0x89/0x153 kernel: [ 358.544447] ? rtnetlink_bind+0x29/0x29 kernel: [ 358.552203] netlink_rcv_skb+0x7e/0xf7 kernel: [ 358.552203] rtnetlink_rcv+0x10/0x12 kernel: [ 358.595722] netlink_unicast+0x157/0x1e0 kernel: [ 358.595722] netlink_sendmsg+0x354/0x39b kernel: [ 358.623663] sock_sendmsg+0x2d/0x3d kernel: [ 358.623663] ___sys_sendmsg+0x1be/0x25c kernel: [ 358.631179] ? sock_destroy_inode+0x2e/0x31 kernel: [ 358.631179] ? evict+0x16f/0x184 kernel: [ 358.652531] ? __this_cpu_preempt_check+0x13/0x15 kernel: [ 358.670673] ? mem_cgroup_event_ratelimit+0x39/0x9c kernel: [ 358.678706] ? debug_smp_processor_id+0x17/0x19 kernel: [ 358.683821] ? __lru_cache_add+0x82/0x9a kernel: [ 358.702399] ? lru_cache_add_active_or_unevictable+0x49/0xba kernel: [ 358.714877] ? _raw_spin_unlock+0x15/0x2a kernel: [ 358.714877] __sys_sendmsg+0x4d/0x8a kernel: [ 358.730951] compat_SyS_sendmsg+0xf/0x11 kernel: [ 358.730951] compat_SyS_socketcall+0x1e8/0x249 kernel: [ 358.763196] ? page_fault+0x2f/0x50 kernel: [ 358.763196] do_fast_syscall_32+0x9e/0xf6 kernel: [ 358.784814] entry_SYSENTER_compat+0x7f/0x8e kernel: [ 358.784814] RIP: 0023:0xf797bad9 kernel: [ 358.811531] RSP: 002b:00000000fff7b0d0 EFLAGS: 00200286 ORIG_RAX: 0000000000000066 kernel: [ 358.828066] RAX: ffffffffffffffda RBX: 0000000000000010 RCX: 00000000fff7b0f0 kernel: [ 358.828066] RDX: 00000000fff83148 RSI: 0000000057296070 RDI: 00000000fff831e8 kernel: [ 358.883942] RBP: 00000000fff83168 R08: 0000000000000000 R09: 0000000000000000 kernel: [

Anyone knows what this is?

emu-docker: command not found

I tried run a command emu-docker -h and have a result emu-docker: command not found.
All requirements are installed.

Logs after the command python setup.py install --user:
`root@autom-android:/home/emulator/android-emulator-container-scripts-master# python setup.py install --user
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running bdist_egg
running egg_info
writing requirements to emu_docker.egg-info/requires.txt
writing emu_docker.egg-info/PKG-INFO
writing top-level names to emu_docker.egg-info/top_level.txt
writing dependency_links to emu_docker.egg-info/dependency_links.txt
writing entry points to emu_docker.egg-info/entry_points.txt
reading manifest file 'emu_docker.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'emu_docker.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/emu
copying build/lib.linux-x86_64-2.7/emu/emu_downloads_menu.py -> build/bdist.linux-x86_64/egg/emu
copying build/lib.linux-x86_64-2.7/emu/docker_device.py -> build/bdist.linux-x86_64/egg/emu
copying build/lib.linux-x86_64-2.7/emu/_version.py -> build/bdist.linux-x86_64/egg/emu
creating build/bdist.linux-x86_64/egg/emu/templates
copying build/lib.linux-x86_64-2.7/emu/templates/Dockerfile -> build/bdist.linux-x86_64/egg/emu/templates
copying build/lib.linux-x86_64-2.7/emu/templates/launch-emulator.sh -> build/bdist.linux-x86_64/egg/emu/templates
copying build/lib.linux-x86_64-2.7/emu/templates/default.pa -> build/bdist.linux-x86_64/egg/emu/templates
creating build/bdist.linux-x86_64/egg/emu/templates/avd
copying build/lib.linux-x86_64-2.7/emu/templates/avd/Pixel2.ini -> build/bdist.linux-x86_64/egg/emu/templates/avd
creating build/bdist.linux-x86_64/egg/emu/templates/avd/Pixel2.avd
copying build/lib.linux-x86_64-2.7/emu/templates/avd/Pixel2.avd/config.ini -> build/bdist.linux-x86_64/egg/emu/templates/avd/Pixel2.avd
copying build/lib.linux-x86_64-2.7/emu/templates/README.md -> build/bdist.linux-x86_64/egg/emu/templates
copying build/lib.linux-x86_64-2.7/emu/init.py -> build/bdist.linux-x86_64/egg/emu
copying build/lib.linux-x86_64-2.7/emu/emu_docker.py -> build/bdist.linux-x86_64/egg/emu
byte-compiling build/bdist.linux-x86_64/egg/emu/emu_downloads_menu.py to emu_downloads_menu.pyc
byte-compiling build/bdist.linux-x86_64/egg/emu/docker_device.py to docker_device.pyc
byte-compiling build/bdist.linux-x86_64/egg/emu/_version.py to _version.pyc
byte-compiling build/bdist.linux-x86_64/egg/emu/init.py to init.pyc
byte-compiling build/bdist.linux-x86_64/egg/emu/emu_docker.py to emu_docker.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying emu_docker.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying emu_docker.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying emu_docker.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying emu_docker.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying emu_docker.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying emu_docker.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
emu._version: module references file
creating 'dist/emu_docker-0+unknown-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing emu_docker-0+unknown-py2.7.egg
removing '/home/groshkka/.local/lib/python2.7/site-packages/emu_docker-0+unknown-py2.7.egg' (and everything under it)
creating /home/groshkka/.local/lib/python2.7/site-packages/emu_docker-0+unknown-py2.7.egg
Extracting emu_docker-0+unknown-py2.7.egg to /home/groshkka/.local/lib/python2.7/site-packages
emu-docker 0+unknown is already the active version in easy-install.pth
Installing emu-docker script to /home/groshkka/.local/bin

Installed /home/groshkka/.local/lib/python2.7/site-packages/emu_docker-0+unknown-py2.7.egg
Processing dependencies for emu-docker==0+unknown
Searching for urlfetch==1.1.3
Best match: urlfetch 1.1.3
Processing urlfetch-1.1.3-py2.7.egg
urlfetch 1.1.3 is already the active version in easy-install.pth

Using /home/groshkka/.local/lib/python2.7/site-packages/urlfetch-1.1.3-py2.7.egg
Searching for tqdm==4.36.1
Best match: tqdm 4.36.1
Processing tqdm-4.36.1-py2.7.egg
tqdm 4.36.1 is already the active version in easy-install.pth
Installing tqdm script to /home/groshkka/.local/bin

Using /home/groshkka/.local/lib/python2.7/site-packages/tqdm-4.36.1-py2.7.egg
Searching for Jinja2==2.10.3
Best match: Jinja2 2.10.3
Processing Jinja2-2.10.3-py2.7.egg
Jinja2 2.10.3 is already the active version in easy-install.pth

Using /home/groshkka/.local/lib/python2.7/site-packages/Jinja2-2.10.3-py2.7.egg
Searching for docker==4.1.0
Best match: docker 4.1.0
Processing docker-4.1.0-py2.7.egg
docker 4.1.0 is already the active version in easy-install.pth

Using /home/groshkka/.local/lib/python2.7/site-packages/docker-4.1.0-py2.7.egg
Searching for console-menu==0.6.0
Best match: console-menu 0.6.0
Processing console_menu-0.6.0-py2.7.egg
console-menu 0.6.0 is already the active version in easy-install.pth

Using /home/groshkka/.local/lib/python2.7/site-packages/console_menu-0.6.0-py2.7.egg
Searching for MarkupSafe==1.1.1
Best match: MarkupSafe 1.1.1
Processing MarkupSafe-1.1.1-py2.7-linux-x86_64.egg
MarkupSafe 1.1.1 is already the active version in easy-install.pth

Using /home/groshkka/.local/lib/python2.7/site-packages/MarkupSafe-1.1.1-py2.7-linux-x86_64.egg
Searching for websocket-client==0.56.0
Best match: websocket-client 0.56.0
Adding websocket-client 0.56.0 to easy-install.pth file

Using /usr/local/lib/python2.7/dist-packages
Searching for six==1.11.0
Best match: six 1.11.0
Adding six 1.11.0 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Searching for requests==2.22.0
Best match: requests 2.22.0
Adding requests 2.22.0 to easy-install.pth file

Using /usr/local/lib/python2.7/dist-packages
Searching for ipaddress==1.0.17
Best match: ipaddress 1.0.17
Adding ipaddress 1.0.17 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Searching for backports.ssl-match-hostname==3.7.0.1
Best match: backports.ssl-match-hostname 3.7.0.1
Adding backports.ssl-match-hostname 3.7.0.1 to easy-install.pth file

Using /usr/local/lib/python2.7/dist-packages
Searching for idna==2.6
Best match: idna 2.6
Adding idna 2.6 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Searching for chardet==3.0.4
Best match: chardet 3.0.4
Adding chardet 3.0.4 to easy-install.pth file
Installing chardetect script to /home/groshkka/.local/bin

Using /usr/local/lib/python2.7/dist-packages
Searching for certifi==2019.9.11
Best match: certifi 2019.9.11
Adding certifi 2019.9.11 to easy-install.pth file

Using /usr/local/lib/python2.7/dist-packages
Searching for urllib3==1.25.6
Best match: urllib3 1.25.6
Adding urllib3 1.25.6 to easy-install.pth file

Using /usr/local/lib/python2.7/dist-packages
Finished processing dependencies for emu-docker==0+unknown`

Do you know where is a problem?

emulator failed to start

emulator_1 | [ 7.604790] init: processing action (encrypt)
emulator_1 | [ 7.604790] init: computing context for service10-29 17:06:12.244 1420 1420 I [email protected]: Registration complete for [email protected]::IComposer/default.
emulator_1 | 10-29 17:06:12.320 1416 1416 I ServiceManagement: Removing namespace from process name [email protected] to [email protected].
emulator_1 | 10-29 17:06:12.325 1416 1416 I [email protected]: Registration complete for [email protected]::IDrmFactory/default.
emulator_1 | 'exec 2 (/system/bin/vdc)'
emulator_1 | [ 7.604790] 10-29 17:06:12.364 1416 1416 I ServiceManagement: Removing namespace from process name [email protected] to [email protected].
emulator_1 | 10-29 17:06:12.368 1416 1416 I [email protected]: Registration complete for [email protected]::ICryptoFactory/default.
emulator_1 | init: starting service 'exec 2 (/system/bin/vdc)'...
emulator_1 | [ 7.621287] init: SVC_EXEC pid 1430 (uid 0 gid 0+0 context default) started; waiting...
emulator_1 | [ 7.640288] init: Service 'exec 2 (/system/bin/vdc)' (pid 1430) exited with status 0 waiting took 0.038637 seconds
emulator_1 | [ 7.776307] init: processing action (vold.decrypt=trigger_shutdown_framework)
emulator_1 | [ 7.776307] init: processin10-29 17:06:12.425 1414 1414 I [email protected]: Camera provider Service is starting.
emulator_1 | g action (init.svc.zygote=stopped)
emulator_1 | [ 7.820269] init: processing action (qemu.logcat=start)
emulator_1 | [ 7.820269] selinux: avc: denied { set } for property=ro.opengles.version pid=1426 uid=0 gid=0 scontext=u:r:qemu_props:s0 tcontext=u:object_r:opengles_prop:s0 tclass=property_service
emulator_1 | [ 7.820269]
emulator_1 | [ 7.820269] init: sys_prop(PROP_MSG_SETPROP2): permission denied uid:0 name:ro.opengles.version
emulator_1 | [ 7.902042] type=1400 audit(1572368771.840:5): avc: denied { getattr } for pid=1434 comm="init.ranchu-cor" path="/system/bin/toybox" dev="vda1" ino=581 scontext=u:r:goldfish_setup:s0 tcontext=u:object_r:toolbox_ex0
emulator_1 | [ 7.920266] init: processing action (vold.decrypt=trigger_post_fs_data)
emulator_1 | [ 7.920266] init: processing action (post-fs-data)
emulator_1 | [ 8.020896] healthd: unable to get HAL interface, using defaults
emulator_1 | [ 8.050632] healthd: BatteryCurrentNowPath not found
emulator_1 | [ 8.050632] healthd: BatteryFullChargeP10-29 17:06:12.542 1414 1414 I vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/camera.ranchu.so from the current namespace instead.
emulator_1 | ath not found
emulator_1 | [ 8.050632] healthd: BatteryCycleCountPath not found
emulator_1 | [ 8.050632] healthd: battery l=100 v=5000 t=25.0 h=2 st=2 chg=a
emulator_1 | [ 8.076498] vdc: 200 1438 Command succeeded
emulator_1 | [ 8.076498] init: init_user0 result: 0
emulator_1 | [ 8.076498] init: Command 'init_user0' action=post-fs-data (/init.rc:489) returned 0 took 73.6188ms.
emulator_1 | [ 8.100567] init: computing context for service 'exec 3 (/system/bin/tzdatacheck)'
emulator_1 | [ 8.110567] init: starting service 'exec 3 (/system/bin/tzdatacheck)'...
emulator_1 | [ 8.110567] init: SVC_EXEC pid 1441 (uid 1000 gid 1000+0 context default) started; waiting...
emulator_1 | [ 8.148936] init: Service 'exec 3 (/system/bin/tzdatacheck)' (pid 1441) exited with status 0 waiting took 0.046772 seconds
emulator_1 | [ 8.252107] type=1400 audit(1572368771.840:5): avc: denied { getattr } for pid=1434 comm="init.ranchu-cor" path="/system/bin/toybox" dev="vda1" ino=581 scontext=u:r:goldfish_setup:s0 tcontext=u:object_r:toolbox_ex0
emulator_1 | [ 10-29 17:06:12.668 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::maxFrameBufferAcquiredBuffers retrieved: 3
emulator_1 | 8.252107] type=1400 audit(1572368772.240:6): avc: denied { getattr } for pid=1444 comm="init.ranchu-cor" path="/system/bin/toybox" dev="vda1" ino=581 scont10-29 17:06:12.686 1428 1428 I /system/bin/surfaceflinger: 0
emulator_1 | ext=u:r:goldfish_setup:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=0
emulator_1 | [ 8.255556] init: Service 'ranchu-setup' (pid 1425) exited 10-29 17:06:12.706 1428 1428 I SurfaceFlinger: SurfaceFlinger is starting
emulator_1 | with status 0
emulator_1 | [ 8.722459] init: computing context for service 'mdnsd'
emulator_1 | [ 8.731145] init: starting service 'mdnsd'...
emulator_1 | [ 8.740602] init: Created socket '/dev/socket/mdnsd', mode 660, user 1020,10-29 17:06:12.738 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::vsyncEventPhaseO)
emulator_1 | 10-29 17:06:12.741 1413 1413 I ServiceManagement: Removing namespace from process name [email protected] to [email protected].
emulator_1 | 10-29 17:06:12.743 1413 1413 I audiohalservice: Registration complete for [email protected]::IDevicesFactory/default.
emulator_1 | group 3003
emulator_1 | 10-29 17:06:12.756 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::vsyncSfEventPhaseOffsetNs retrieved: 1000000 (default)
emulator_1 | 10-29 17:06:12.775 1414 1414 D EmulatedCamera_QemuClient: Emulated camera list:
emulator_1 | 10-29 17:06:12.775 1414 1414 D EmulatedCamera_FakeCamera: Initialize: Fake camera is facing back
emulator_1 | 10-29 17:06:12.776 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasSyncFramework retrieved: 1
emulator_1 | 10-29 17:06:12.776 1414 1414 V EmulatedCamera_Device: initializeWhiteBalanceModes with auto, 1.000000, 1.000000
emulator_1 | 10-29 17:06:12.777 1414 1414 V EmulatedCamera_Device: initializeWhiteBalanceModes with incandescent, 1.380000, 0.600000
emulator_1 | 10-29 17:06:12.777 1414 1414 V EmulatedCamera_Device: initializeWhiteBalanceModes with daylight, 1.090000, 0.920000
emulator_1 | 10-29 17:06:12.777 1414 1414 V EmulatedCamera_Device: initializeWhiteBalanceModes with twilight, 0.920000, 1.220000
emulator_1 | 10-29 17:06:12.777 1414 1414 V EmulatedCamera_Device: setWhiteBalanceMode with white balance auto
emulator_1 | 10-29 17:06:12.777 1414 1414 D EmulatedCamera_FakeCamera: Initialize: Fake camera is facing front
emulator_1 | 10-29 17:06:12.778 1414 1414 V EmulatedCamera_Device: initializeWhiteBalanceModes with auto, 1.000000, 1.000000
emulator_1 | 10-29 17:06:12.779 1414 1414 V EmulatedCamera_Device: initializeWhiteBalanceModes with incandescent, 1.380000, 0.600000
emulator_1 | 10-29 17:06:12.779 1414 1414 V EmulatedCamera_Device: initializeWhiteBalanceModes with daylight, 1.090000, 0.920000
emulator_1 | 10-29 17:06:12.779 1414 1414 V EmulatedCamera_Device: initializeWhiteBalanceModes with twilight, 0.920000, 1.220000
emulator_1 | 10-29 17:06:12.779 1414 1414 V EmulatedCamera_Device: setWhiteBalanceMode with white balance auto
emulator_1 | 10-29 17:06:12.779 1414 1414 E EmulatedCamera_Factory: 2 cameras are being emulated. 2 of them are fake cameras.
emulator_1 | 10-29 17:06:12.779 1414 1414 E EmulatedCamera_HotplugThread: createFileIfNotExists: Could not create file '/data/misc/media/emulator.camera.hotplug.0', error: 'Permission denied' (13)
emulator_1 | 10-29 17:06:12.779 1414 1414 E EmulatedCamera_HotplugThread: createFileIfNotExists: Could not create file '/data/misc/media/emulator.camera.hotplug.1', error: 'Permission denied' (13)
emulator_1 | 10-29 17:06:12.780 1414 1414 I [email protected]: Loaded "Emulated Camera Module" camera module
emulator_1 | 10-29 17:06:12.780 1414 1414 E [email protected]: setUpVendorTags: Vendor tag operations not fully defined. Ignoring definitions.
emulator_1 | 10-29 17:06:12.780 1414 1414 E [email protected]: initialize: Vendor tag setup failed, will not be available.
emulator_1 | 10-29 17:06:12.780 1414 1414 V EmulatedCamera_Camera: getCameraInfo
emulator_1 | 10-29 17:06:12.781 1414 1414 V EmulatedCamera_BaseCamera: getCameraInfo
emulator_1 | 10-29 17:06:12.781 1414 1414 V EmulatedCamera_Camera: getCameraInfo
emulator_1 | 10-29 17:06:12.781 1414 1414 V EmulatedCamera_BaseCamera: getCameraInfo
emulator_1 | 10-29 17:06:12.781 1414 1414 V EmulatedCamera_Camera: getCameraInfo
emulator_1 | 10-29 17:06:12.781 1414 1414 V EmulatedCamera_BaseCamera: getCameraInfo
emulator_1 | 10-29 17:06:12.781 1414 1414 V EmulatedCamera_Camera: getCameraInfo
emulator_1 | 10-29 17:06:12.781 1414 1414 V EmulatedCamera_BaseCamera: getCameraInfo
emulator_1 | 10-29 17:06:12.788 1414 1414 I ServiceManagement: Removing namespace from process name [email protected] to [email protected].
emulator_1 | 10-29 17:06:12.793 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::useContextPriority retrieved: 0 (default)
emulator_1 | 10-29 17:06:12.794 1413 1413 I audiohalservice: Registration complete for [email protected]::IEffectsFactory/default.
emulator_1 | 10-29 17:06:12.796 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::presentTimeOffsetFromVSyncNs retrieved: 0
emulator_1 | 10-29 17:06:12.798 1414 1414 I [email protected]: Registration complete for [email protected]::ICameraProvider/legacy/0.
emulator_1 | 10-29 17:06:12.800 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::useHwcForRGBtoYUV retrieved: 0
emulator_1 | 10-29 17:06:12.805 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::maxVirtualDisplaySize retrieved: 0 (default)
emulator_1 | 10-29 17:06:12.812 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::useVrFlinger retrieved: 0 (default)
emulator_1 | 10-29 17:06:12.812 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::maxFrameBufferAcquiredBuffers retrieved: 3
emulator_1 | 10-29 17:06:12.815 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
emulator_1 | 10-29 17:06:12.816 1428 1428 I SurfaceFlinger: Enabling HWC virtual displays
emulator_1 | 10-29 17:06:12.816 1428 1428 I SurfaceFlinger: Disabling Triple Buffering
emulator_1 | 10-29 17:06:12.816 1428 1428 I SurfaceFlinger: SurfaceFlinger's main thread ready to run. Initializing graphics H/W...
emulator_1 | 10-29 17:06:12.816 1428 1428 I SurfaceFlinger: Phase offest NS: 1000000
emulator_1 | 10-29 17:06:12.817 1428 1428 D libEGL : Emulator has host GPU support, qemu.gles is set to 1.
emulator_1 | 10-29 17:06:12.819 1413 1413 E SoundTriggerHalImpl: couldn't load sound trigger module sound_trigger.primary (No such file or directory)
emulator_1 | 10-29 17:06:12.826 1413 1413 I audiohalservice: Registration complete for [email protected]::ISoundTriggerHw/default.
emulator_1 | [ 8.830275] type=1400 audit(1572368772.240:6): avc: denied { getattr } f10-29 17:06:12.832 1428 1428 E vndksupport: Could not load /vendor/lib/egl/libGLES_emulation.so from sphal namespace: dlopen failed: librar.
emulator_1 | 10-29 17:06:12.832 1428 1428 E libEGL : load_driver(/vendor/lib/egl/libGLES_emulation.so): unknown
emulator_1 | or pid=1444 comm="init.ranchu-cor" path="/system/bin/toybox" dev="vda1" ino=581 scontext=u:r:goldfish_setup:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=0
emulator_1 | [ 8.850494] type=1400 audit(1572368772.820:7): avc: denied { search } for pid=1454 comm="mdnsd10-29 17:06:12.865 1413 1413 I audiohalservice: Registration complete for [email protected]::IBroad.
emulator_1 | " name="run" dev="tmpfs" ino=1231 scontext=u:r:mdnsd:s0 tcontext=u:object_r:varru10-29 17:06:12.867 1428 1428 D libEGL : loaded /vendor/lib/egl/libEGL_emulation.so
emulator_1 | n_file:s0 tclass=dir permissive=0
emulator_1 | 10-29 17:06:12.879 1428 1428 D libEGL : loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
emulator_1 | 10-29 17:06:12.892 1428 1428 D libEGL : loaded /vendor/lib/egl/libGLESv2_emulation.so
emulator_1 | 10-29 17:06:12.900 1428 1428 D : HostConnection::get() New Host Connection established 0xb2fa3f00, tid 1428
emulator_1 | 10-29 17:06:12.907 1428 1428 I SurfaceFlinger: EGL information:
emulator_1 | 10-29 17:06:12.907 1428 1428 I SurfaceFlinger: vendor : Android
emulator_1 | 10-29 17:06:12.907 1428 1428 I SurfaceFlinger: version : 1.4 Android META-EGL
emulator_1 | 10-29 17:06:12.907 1428 1428 I SurfaceFlinger: extensions: EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time EGL_KHR_swap_buffers_with_damage EGL_ANDROID_get_native_client_buffer EGL_ANDROID_front_buffer
emulator_1 | 10-29 17:06:12.907 1428 1428 I SurfaceFlinger: Client API: OpenGL_ES
emulator_1 | 10-29 17:06:12.907 1428 1428 I SurfaceFlinger: EGLSurface: 8-8-8-8, config=0x2
emulator_1 | 10-29 17:06:12.911 1428 1428 D EGL_emulation: eglCreateContext: 0xb2fa0900: maj 2 min 0 rcv 2
emulator_1 | 10-29 17:06:12.916 1428 1428 D EGL_emulation: eglMakeCurrent: 0xb2fa0900: ver 2 0 (tinfo 0xb2f9ba00)
emulator_1 | 10-29 17:06:12.927 1428 1428 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
emulator_1 | 10-29 17:06:12.928 1428 1428 I SurfaceFlinger: OpenGL ES informations:
emulator_1 | 10-29 17:06:12.928 1428 1428 I SurfaceFlinger: vendor : Google (Google Inc.)
emulator_1 | 10-29 17:06:12.928 1428 1428 I SurfaceFlinger: renderer : Android Emulator OpenGL ES Translator (Google SwiftShader)
emulator_1 | 10-29 17:06:12.928 1428 1428 I SurfaceFlinger: version : OpenGL ES 2.0 (OpenGL ES 3.0 SwiftShader 4.0.0.1)
emulator_1 | 10-29 17:06:12.928 1428 1428 I SurfaceFlinger: extensions: GL_EXT_debug_marker GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_
emulator_1 | 10-29 17:06:12.928 1428 1428 I SurfaceFlinger: GL_MAX_TEXTURE_SIZE = 8192
emulator_1 | 10-29 17:06:12.928 1428 1428 I SurfaceFlinger: GL_MAX_VIEWPORT_DIMS = 8192
emulator_1 | 10-29 17:06:12.942 1420 1420 I vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.ranchu.so from the current namespace instead.
emulator_1 | 10-29 17:06:12.977 1419 1419 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
emulator_1 | 10-29 17:06:13.147 1419 1419 I chatty : uid=1000(system) [email protected] identical 1 line
emulator_1 | 10-29 17:06:13.156 1419 1419 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
emulator_1 | 10-29 17:06:13.165 1428 1428 D SurfaceFlinger: Set active color mode: HAL_COLOR_MODE_NATIVE (0), type=0
emulator_1 | 10-29 17:06:13.169 1428 1428 D EGL_emulation: eglMakeCurrent: 0xb2fa0900: ver 2 0 (tinfo 0xb2f9ba00)
emulator_1 | 10-29 17:06:13.382 1428 1428 D SurfaceFlinger: shader cache generated - 24 shaders in 209.133926 ms
emulator_1 | [ 9.10-29 17:06:13.388 1428 1428 D SurfaceFlinger: Set power mode=2, type=0 flinger=0xb2fc9000
emulator_1 | 387175] init: computing context for service 'bootanim'
emulator_1 | [ 9.394186] init: starting service 'bootanim'...
emulator_1 | 10-29 17:06:14.059 1428 1449 E SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
emulator_1 | 10-29 17:06:14.070 1471 1474 D libEGL : Emulator has host GPU support, qemu.gles is set to 1.
emulator_1 | 10-29 17:06:14.073 1471 1474 E vndksupport: Could not load /vendor/lib/egl/libGLES_emulation.so from sphal namespace: dlopen failed: library "/vendor/lib/egl/libGLES_emulation.so" not found.
emulator_1 | 10-29 17:06:14.073 1471 1474 E libEGL : load_driver(/vendor/lib/egl/libGLES_emulation.so): unknown
emulator_1 | 10-29 17:06:14.083 1471 1474 D libEGL : loaded /vendor/lib/egl/libEGL_emulation.so
emulator_1 | 10-29 17:06:14.084 1471 1474 D libEGL : loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
emulator_1 | 10-29 17:06:14.097 1471 1474 D libEGL : loaded /vendor/lib/egl/libGLESv2_emulation.so
emulator_1 | 10-29 17:06:14.111 1471 1474 D : HostConnection::get() New Host Connection established 0xb1f0c100, tid 1474
emulator_1 | 10-29 17:06:14.118 1419 1419 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
emulator_1 | 10-29 17:06:14.129 1428 1449 D : HostConnection::get() New Host Connection established 0xb2fde780, tid 1449
emulator_1 | 10-29 17:06:14.178 1365 1365 D TrustyKeymaster: Device received generate_key
emulator_1 | 10-29 17:06:14.178 1365 1365 E TrustyKeymaster: calling trusty_keymaster_call insize 85 msg size 89
emulator_1 | 10-29 17:06:14.241 1365 1365 E TrustyKeymaster: Received 1534 byte response
emulator_1 | 10-29 17:06:14.247 1366 1431 I Cryptfs : Using scrypt with keymaster for cryptfs KDF
emulator_1 | 10-29 17:06:14.495 1471 1474 D EGL_emulation: eglCreateContext: 0xb1f13420: maj 1 min 0 rcv 1
emulator_1 | 10-29 17:06:14.518 1471 1474 D EGL_emulation: eglMakeCurrent: 0xb1f13420: ver 1 0 (tinfo 0xb1f0b0b0)
emulator_1 | 10-29 17:06:15.350 1366 1431 I Cryptfs : Signing safely-padded object
emulator_1 | 10-29 17:06:15.354 1365 1365 D TrustyKeymaster: Device received begin
emulator_1 | 10-29 17:06:15.354 1365 1365 E TrustyKeymaster: calling trusty_keymaster_call insize 1401 msg size 1405
emulator_1 | 10-29 17:06:15.354 1365 1365 E TrustyKeymaster: Received 24 byte response
emulator_1 | 10-29 17:06:15.357 1365 1365 D TrustyKeymaster: Device received update
emulator_1 | 10-29 17:06:15.357 1365 1365 E TrustyKeymaster: calling trusty_keymaster_call insize 280 msg size 284
emulator_1 | 10-29 17:06:15.357 1365 1365 E TrustyKeymaster: Received 24 byte response
emulator_1 | 10-29 17:06:15.358 1365 1365 E TrustyKeymaster: Device received finish
emulator_1 | 10-29 17:06:15.358 1365 1365 E TrustyKeymaster: calling trusty_keymaster_call insize 28 msg size 32
emulator_1 | 10-29 17:06:15.361 1365 1365 E TrustyKeymaster: Received 276 byte response
emulator_1 | 10-29 17:06:15.362 1365 1365 E TrustyKeymaster: here finish at 619 output data length 256
emulator_1 | 10-29 17:06:15.363 1365 1365 E TrustyKeymaster: OK here finish at 627
emulator_1 | 10-29 17:06:15.756 1471 1474 D BootAnimation: BootAnimationShownTiming start time: 11756ms
emulator_1 | 10-29 17:06:15.853 1366 1431 I Cryptfs : Using scrypt with keymaster for cryptfs KDF

typo in run-with-gpu.sh

missing dash before TOKEN

docker run --gpus all -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -e "TOKEN=$(cat ~/.emulator_console_auth_token)" -e "ADBKEY=$(cat ~/.android/adbkey)" -e "EMULATOR_PARAMS=-gpu host ${PARAMS}" --device /dev/kvm --publish 8556:8556/tcp --publish 5555:8555/tcp ${CONTAINER_ID}

Emulator proxy

Hi is it possible set emulator proxy configuration? Like
emulator -avd myavd -http-proxy http://168.192.1.2:3300

Emulator not available via web, but is booted completely

Emulator not available via web, but is booted completely,
When I did nmap -T4 I got
Screen Shot 2020-01-23 at 10 01 18 PM
So no port is active
But emulator is booted
Screen Shot 2020-01-23 at 10 01 43 PM
Do you have any idea's as to why i'm unable to connect?
I'm running on GCE with a Debian 9 VM with KVM enabled, I do have https and HTTP in the firewall rules on and access to a desktop via VNC, I got the webview started but, it says in the console logs that unable to connect localhost:8080 which that port isn't listening on

failed to authenticate to localhost:5555

Why do I get "failed to authenticate to localhost:5555" message after docker-compose command?

$ docker-compose -f js/docker/docker-compose-with-adb.yaml up
$ adb connect localhost:5555
failed to authenticate to localhost:5555
$ adb devices
List of devices attached
localhost:5555	unauthorized

BUT it is okay below.

$ ./run.sh docker_emulator
$ adb connect localhost:5555
$ adb devices
List of devices attached
localhost:5555	device

ModuleNotFoundError: No module named 'packaging'

After this commit I started getting an error when using emu-docker:

(venv) [user@localhost android-emulator-container-scripts]$ emu-docker interactive
Traceback (most recent call last):
  File "/home/user/Code/google/android-emulator-container-scripts/venv/bin/emu-docker", line 11, in <module>
    load_entry_point('emu-docker', 'console_scripts', 'emu-docker')()
  File "/home/user/Code/google/android-emulator-container-scripts/venv/lib64/python3.6/site-packages/pkg_resources/__init__.py", line 476, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/user/Code/google/android-emulator-container-scripts/venv/lib64/python3.6/site-packages/pkg_resources/__init__.py", line 2700, in load_entry_point
    return ep.load()
  File "/home/user/Code/google/android-emulator-container-scripts/venv/lib64/python3.6/site-packages/pkg_resources/__init__.py", line 2318, in load
    return self.resolve()
  File "/home/user/Code/google/android-emulator-container-scripts/venv/lib64/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/user/Code/google/android-emulator-container-scripts/emu/emu_docker.py", line 29, in <module>
    from emu.docker_device import DockerDevice
  File "/home/user/Code/google/android-emulator-container-scripts/emu/docker_device.py", line 25, in <module>
    from packaging import version
ModuleNotFoundError: No module named 'packaging'

It worked fine after these two commands:

pip3 install --upgrade pip
pip3 install packaging

Not sure if it's python only thingy or related to this project but feel free to close if doesn't require any action on your side.

How to know when the container is ready?

I'm running the images in my CI but I'm having big troubles knowing when the image is ready. I'm using the script android-wait-for-emulator but when I check with adb devices the device is still offline. If I wait for 30 seconds (sleep 30) and rerun the adb devices it is usually ready.

A script to check if the container is ready to receive commads would be really helpful.

[want help]get a erro when docker-compose -f js/docker/docker-compose.yaml build

docker-compose -f js/docker/docker-compose.yaml build
Building front-envoy
Step 1/6 : FROM envoyproxy/envoy:latest
 ---> b693bfa561c7
Step 2/6 : COPY ./envoy.yaml /etc/envoy/envoy.yaml
 ---> Using cache
 ---> 48a1891849f7
Step 3/6 : ADD certs/self_sign.crt /etc/cert.crt
 ---> Using cache
 ---> 9dcf1972aca5
Step 4/6 : ADD certs/self_sign.key /etc/key.key
 ---> Using cache
 ---> 8655e86103fe
Step 5/6 : ADD certs/jwt_secrets_pub.jwks /etc/jwt_secrets_pub.jwks
ERROR: Service 'front-envoy' failed to build: ADD failed: stat /var/lib/docker/tmp/docker-builder046243671/certs/jwt_secrets_pub.jwks: no such file or directory

Emulator is running but cannot connect to it

I have successfully ran the emulator, from the logs, it looks like its booting up just fine. However when, I connect to it via adb connect :5555 and then type adb devices, I get the following:
<IP Address>:5555 offline

Furthermore, when accessing the emulator through the react website, I can only see a black screen that that does not change to anything no matter how long I wait, see attached screenshot:
image

Anyone know what could be the issue here?

Emulator is not started [UnHealthy Status] :

Environment : Linux andrpoc4-3230633 4.15.0-51-generic #55-Ubuntu SMP Wed May 15 14:27:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Emulator : p-google-x64 29.3.4 02e0994de0a1 24 hours ago 3.73GB
docker ps showing unhealthy status.

Hi There, Thank you for actively making changes. I have been following and trying this script from last year. I am using eBay internal VM's.

I could not figure out why this docker emulator went unhealthy status. if you can point out any pointer would be helpful. let me know if you need any more logs.

ERROR : docker-compose -f js/docker/docker-compose.yaml up

Hi,

I am probably missing something simple but I'm getting this error when trying to run compose both in venv or not.

Pulling front-envoy (emulator_envoy:latest)...
ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.``

Program abort

When I execute ‘emu-docker create emulator-linux-5889189.zip x86_64-29_r09.zip’
It only performed 10 steps and then stopped.

Creating docker image: aemu:google_apis-29-Q-x86_64-29.2.1.. be patient this can take a while!
Step 1/27 : FROM alpine AS unzipper
---> 965ea09ff2eb
Step 2/27 : RUN apk add --update unzip
---> Using cache
---> ef2cc9a3b1c2
Step 3/27 : COPY emulator-linux-5889189.zip /tmp/
---> Using cache
---> 575817e1ec6a
Step 4/27 : RUN unzip -u -o /tmp/emulator-linux-5889189.zip -d /emu/
---> Using cache
---> c411a938cc93
Step 5/27 : FROM nvidia/opengl:1.0-glvnd-runtime-ubuntu18.04 AS emulator
---> 89c25683761b
Step 6/27 : ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES},display
---> Using cache
---> 41ddf1b87817
Step 7/27 : RUN apt-get update && apt-get install -y --no-install-recommends libc6 libdbus-1-3 libfontconfig1 libgcc1 libpulse0 libtinfo5 libx11-6 libxcb1 libxdamage1 libnss3 libxcomposite1 libxcursor1 libxi6 libxext6 libxfixes3 zlib1g libgl1 pulseaudio socat curl ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
---> Using cache
---> 311a2b415acb
Step 8/27 : RUN mkdir -p /android/sdk/platforms && mkdir -p /android/sdk/platform-tools && mkdir -p /android/sdk/system-images && mkdir -p /android-home
---> Using cache
---> 3ccb3481f54d
Step 9/27 : COPY launch-emulator.sh /android/sdk/
---> Using cache
---> 7a176a4df2c9
Step 10/27 : COPY platform-tools/adb /android/sdk/platform-tools/adb

support non-KVM, non-privileged runners (currently works with ARM emulators)

Its great to see Google officially support running the emulator in Docker containers!

The big, public CI services like Travis, GitLab-CI, etc. do not provide KVM or privileged runners by default. That means people have to run their own runners, which is a big chunk of work. The ARM emulators work in Docker without KVM or privileged. Yes, they are very slow, but they work.

keyError

Thanks a lot of documentation。
When I execute the following command, I get an error.
emu-docker create x86_64-29_r09.zip emulator-linux-5889189.zip --dest docker-src-dir

Traceback (most recent call last):
File "/test/android-emulator-container-scripts/android-emulator-container-scripts/venv/bin/emu-docker", line 11, in
load_entry_point('emu-docker', 'console_scripts', 'emu-docker')()
File "/test/android-emulator-container-scripts/android-emulator-container-scripts/emu/emu_docker.py", line 151, in main
args.func(args)
File "/test/android-emulator-container-scripts/android-emulator-container-scripts/emu/emu_docker.py", line 43, in create_docker_image
device.create_docker_file(args.extra)
File "/test/android-emulator-container-scripts/android-emulator-container-scripts/emu/docker_device.py", line 163, in create_docker_file
"cpu": self.sysimg.cpu(),
File "/test/android-emulator-container-scripts/android-emulator-container-scripts/emu/emu_downloads_menu.py", line 117, in cpu
return self.ABI_CPU_MAP[self.abi()]
KeyError: ''

Device is offline with non UI CentOS

Device is offline right after adb connect localhost:5555.

Since I am using non UI CentOS, I cannot make if online.

If I know public IP of the emulator and connect it from my MAC, it would be okay.

[want help]get a error when run ./create_web_container.sh

./create_web_container.sh 
./create_web_container.sh: 39: ./create_web_container.sh: [[: not found
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'project_urls'
  warnings.warn(msg)
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
  Failed building wheel for cryptography
Command "/home/hzgood/docker/android-emulator-container-scripts/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-r6jrltr3/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-v2a_xhqm-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/hzgood/docker/android-emulator-container-scripts/venv/include/site/python3.5/cryptography" failed with error code 1 in /tmp/pip-build-r6jrltr3/cryptography/
You are using pip version 8.1.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Traceback (most recent call last):
  File "gen-passwords.py", line 9, in <module>
    from jwcrypto import jwk
ImportError: No module named 'jwcrypto'

error: can't copy 'emu/templates/avd': doesn't exist or not a regular file

When I run

$python setup.py install --user

I get the error below

error: can't copy 'emu/templates/avd': doesn't exist or not a regular file

Even if I copy avd manually, I get the error emu-docker: command for emu-docker -h

$ emu-docker -h
-bash: emu-docker: command not found

Full logs

$ python setup.py install --user
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'
  warnings.warn(msg)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
running install
running bdist_egg
running egg_info
writing requirements to emu_docker.egg-info/requires.txt
writing emu_docker.egg-info/PKG-INFO
writing top-level names to emu_docker.egg-info/top_level.txt
writing dependency_links to emu_docker.egg-info/dependency_links.txt
writing entry points to emu_docker.egg-info/entry_points.txt
reading manifest file 'emu_docker.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'emu_docker.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.14-intel/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/emu
copying emu/emu_docker.py -> build/lib/emu
copying emu/_version.py -> build/lib/emu
copying emu/__init__.py -> build/lib/emu
copying emu/emu_downloads_menu.py -> build/lib/emu
copying emu/docker_device.py -> build/lib/emu
creating build/lib/emu/templates
copying emu/templates/default.pa -> build/lib/emu/templates
copying emu/templates/Dockerfile -> build/lib/emu/templates
copying emu/templates/launch-emulator.sh -> build/lib/emu/templates
copying emu/templates/README.md -> build/lib/emu/templates
error: can't copy 'emu/templates/avd': doesn't exist or not a regular file
dgulcan-mb:android-emulator-container-scripts-master dogan.gulcan$ mkdir build
dgulcan-mb:android-emulator-container-scripts-master dogan.gulcan$ python setup.py install --user
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'
  warnings.warn(msg)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
running install
running bdist_egg
running egg_info
writing requirements to emu_docker.egg-info/requires.txt
writing emu_docker.egg-info/PKG-INFO
writing top-level names to emu_docker.egg-info/top_level.txt
writing dependency_links to emu_docker.egg-info/dependency_links.txt
writing entry points to emu_docker.egg-info/entry_points.txt
reading manifest file 'emu_docker.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'emu_docker.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.14-intel/egg
running install_lib
running build_py
creating build/lib
creating build/lib/emu
copying emu/emu_docker.py -> build/lib/emu
copying emu/_version.py -> build/lib/emu
copying emu/__init__.py -> build/lib/emu
copying emu/emu_downloads_menu.py -> build/lib/emu
copying emu/docker_device.py -> build/lib/emu
creating build/lib/emu/templates
copying emu/templates/default.pa -> build/lib/emu/templates
copying emu/templates/Dockerfile -> build/lib/emu/templates
copying emu/templates/launch-emulator.sh -> build/lib/emu/templates
copying emu/templates/README.md -> build/lib/emu/templates
error: can't copy 'emu/templates/avd': doesn't exist or not a regular file

Use alternative ports to start emulator

I know the docs mention that the emulator scripts will actually use port 80, but I want to run this in an environment in which port 80 is already being used. I have already setup everything, my only issue is when I run docker-compose -f js/docker/docker-compose.yaml up, I get the following error:
ERROR: for front-envoy Cannot start service front-envoy: driver failed programming external connectivity on endpoint docker_front-envoy_1 (fe2ce6554b4ae3dad06850b1911d1d7791ccc095a43b083322b05a7c2a830381): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use

Is this actually possible?

Unable to run `emu-docker create` successfully

I tried with both Python 2.7 and 3.6.8

with 2.7, the error I get is:

Traceback (most recent call last):
  File "./emu/emu_docker.py", line 191, in <module>
    main()
  File "./emu/emu_docker.py", line 184, in main
    args.func(args)
  File "./emu/emu_docker.py", line 125, in create_docker_image
    create_docker(args.dest, args.emuzip, args.imgzip, args.repo, args.extra)
  File "./emu/emu_docker.py", line 45, in create_docker
    mkdir_p(src_dir)
  File "./emu/emu_docker.py", line 31, in mkdir_p
    os.makedirs(path, exist_ok=True)
TypeError: makedirs() got an unexpected keyword argument 'exist_ok'

which seems like an issue with python3 compatibility

with 3.6.8, the error i get is:

Copying zips to docker src dir: /home/<user>/android-emulator-container-scripts/src
Traceback (most recent call last):
  File "./emu/emu_docker.py", line 191, in <module>
    main()
  File "./emu/emu_docker.py", line 184, in main
    args.func(args)
  File "./emu/emu_docker.py", line 125, in create_docker_image
    create_docker(args.dest, args.emuzip, args.imgzip, args.repo, args.extra)
  File "./emu/emu_docker.py", line 69, in create_docker
    shutil.copy2(adb_loc, platform_tools_dir)
  File "/usr/lib64/python3.6/shutil.py", line 262, in copy2
    dst = os.path.join(dst, os.path.basename(src))
  File "/usr/lib64/python3.6/posixpath.py", line 146, in basename
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Error stream

Hello, until today building an web container for the Android emulator worked just fine.
Now I`m having this issue:
"upstream connect error or disconnect/reset before headers. reset reason: connection failure" , upon accessing localhost in browswer.

Could you please help me?

Q playstore images missing

Do you maybe know when would Q playstore images be available? They are available via Android Studio:
Screenshot 2019-12-09 at 11 16 19

But only non-playstore are available via emu-docker:

(venv) $ emu-docker list | grep "SYSIMG 29"
SYSIMG 29 Q google_apis x86_64 https://dl.google.com/android/repository/sys-img/google_apis/x86_64-29_r09.zip
SYSIMG 29 Q google_apis x86 https://dl.google.com/android/repository/sys-img/google_apis/x86-29_r09.zip

We use playstore images to test our app features involving FCM push messages.

Thank you.

Regards,
Dragan

adb is installed at the wrong location

adb should be unzipped in src/platform-tools/adb but right now is unzipped at src/platform-tools/adb/platform-tools/adb. For this reason the healthy state is always unhealthy.

Fail to start web UI to interact with emulator.

I got error when trying to launch web UI to interact with emulator. Please help to fix it.
Command: docker-compose -f js/docker/docker-compose.yaml build

Step 1/6 : FROM envoyproxy/envoy:latest
latest: Pulling from envoyproxy/envoy
16c48d79e9cc: Pull complete
3c654ad3ed7d: Pull complete
6276f4f9c29d: Pull complete
a4bd43ad48ce: Pull complete
ef9506777d3e: Pull complete
2e7ad8d4ceb7: Pull complete
d9e379d45dad: Pull complete
b283a3f5aebc: Pull complete
095fe71f6465: Pull complete
Digest: sha256:a7769160c9c1a55bb8d07a3b71ce5d64f72b1f665f10d81aa1581bc3cf850d09
Status: Downloaded newer image for envoyproxy/envoy:latest
 ---> 72e91d8680d8
Step 2/6 : COPY ./envoy.yaml /etc/envoy/envoy.yaml
 ---> 5bd234bf88da
Step 3/6 : ADD certs/self_sign.crt /etc/cert.crt
 ---> d85d47f62a14
Step 4/6 : ADD certs/self_sign.key /etc/key.key
 ---> 1c22d750f457
Step 5/6 : ADD certs/jwt_secrets_pub.jwks /etc/jwt_secrets_pub.jwks
ERROR: Service 'front-envoy' failed to build: ADD failed: stat /var/snap/docker/common/var-lib-docker/tmp/docker-builder085442460/certs/jwt_secrets_pub.jwks: no such file or directory```

Test multiple android emulator

Is it now possible to support creating multiple different containers? I want to test on multiple android emulator simultaneously.

Multiple emulators

Hi,

This is a great project!

How can we use this (rpc/webrtc) with multiple emulators?

  • With envoy.yaml - how do we specify multiple endpoints and use javascript to connect to the correct endpoint?
  • Similar for WebRTC + TURN/STUN, how do we use this in combination with multiple emulators?

Thanks

[want help]get a erro when docker-compose -f js/docker/docker-compose.yaml build]

root@n2-016-026:/home/android-emulator-container-scripts# docker-compose -f js/docker/docker-compose.yaml build
Building front-envoy
Step 1/6 : FROM envoyproxy/envoy:latest
---> 6ef6783c42c8
Step 2/6 : COPY ./envoy.yaml /etc/envoy/envoy.yaml
---> Using cache
---> 6edea85922af
Step 3/6 : ADD certs/self_sign.crt /etc/cert.crt
---> Using cache
---> fbc1436b8110
Step 4/6 : ADD certs/self_sign.key /etc/key.key
---> Using cache
---> 70efe001c7cd
Step 5/6 : ADD certs/jwt_secrets_pub.jwks /etc/jwt_secrets_pub.jwks
ERROR: Service 'front-envoy' failed to build: ADD failed: stat /data00/var_lib_docker/tmp/docker-builder108436929/certs/jwt_secrets_pub.jwks: no such file or directory

Touch events are not handled properly

Touch event handling wasn't implemented in /js/src/components/emulator/views/webrtc_view.js so I did it.
I followed the protobuf specs and I think the code is correct and I also see the following logs from the emulator for a 3 finger multi-touch:

emulator: INFO: LoggingInterceptor.cpp:71: 1582287029937053, rcvTime: 75, sndTime: 195, UNARY, rcv: 232, snd: 24, /android.emulation.control.EmulatorController/sendTouch(touches { x: 376 y: 385 } touches { x: 215 y: 431 identifier: 1 } touches { x: 87 y: 633 identifier: 2 }) -> [], OK
emulator: INFO: LoggingInterceptor.cpp:71: 1582287029943074, rcvTime: 57, sndTime: 178, UNARY, rcv: 184, snd: 24, /android.emulation.control.EmulatorController/sendTouch(touches { x: 376 y: 385 } touches { x: 87 y: 633 identifier: 2 }) -> [], OK
emulator: INFO: LoggingInterceptor.cpp:71: 1582287029946857, rcvTime: 53, sndTime: 175, UNARY, rcv: 136, snd: 24, /android.emulation.control.EmulatorController/sendTouch(touches { x: 376 y: 385 }) -> [], OK
emulator: INFO: LoggingInterceptor.cpp:71: 1582287029947654, rcvTime: 26, sndTime: 188, UNARY, rcv: 48, snd: 24, /android.emulation.control.EmulatorController/sendTouch() -> [], OK

...but nothing happens on the emulator.

I added multi-touch to my Pixel2 config.ini:
hw.screen=multi-touch
and I start the elulator with the following command in launch-emulator.sh:

exec emulator/emulator @Pixel2 -no-audio -verbose -wipe-data \
  -ports 6554,6555 \
  -grpc 5556 -no-window -skip-adb-auth \
  -no-snapshot \
  -screen multi-touch \    <-- enable multi-touch support
  -no-boot-anim \
  -shell-serial file:/tmp/android-unknown/kernel.log \
  -logcat-output /tmp/android-unknown/logcat.log \
  -feature  AllowSnapshotMigration \
  -gpu swiftshader_indirect \
  {{extra}} ${EMULATOR_PARAMS} -qemu -append panic=1

I still see these log lines after stating the mulator:

emulator: Starting QEMU main loop
...
emulator: goldfish_events.have-touch: false
emulator: goldfish_events.have-multitouch: false

If I access the emulator container and I monitor the event with adb:
adb shell getevent -l
I see the the following for a single touch:

/dev/input/event1: EV_ABS       ABS_MT_POSITION_X    000000f1            
/dev/input/event1: EV_ABS       ABS_MT_POSITION_Y    000001d7            
/dev/input/event1: EV_SYN       SYN_REPORT           00000000

...and the following for a 2 finger multi-touch:

/dev/input/event1: EV_ABS       ABS_MT_SLOT          00000000            
/dev/input/event1: EV_ABS       ABS_MT_POSITION_X    00000155            
/dev/input/event1: EV_ABS       ABS_MT_POSITION_Y    000001a1            
/dev/input/event1: EV_SYN       SYN_REPORT           00000000            
/dev/input/event1: EV_ABS       ABS_MT_SLOT          00000001            
/dev/input/event1: EV_ABS       ABS_MT_POSITION_X    000000c4            
/dev/input/event1: EV_ABS       ABS_MT_POSITION_Y    00000152            
/dev/input/event1: EV_SYN       SYN_REPORT           00000000            
/dev/input/event1: EV_ABS       ABS_MT_POSITION_X    000000c5            

Can anyone help me what should I do to get this work? I would appreciate it a lot.

used images:
SYSIMG 29 Q google_apis x86 https://dl.google.com/android/repository/sys-img/google_apis/x86-29_r09.zip
EMU stable 30.0.0 linux https://dl.google.com/android/repository/emulator-linux-6203977.zip

Huge images

The images that this scripts provide are huge. An example: If we pick 29 Q google_apis_playstore (x86) and EMU stable 29.2.1 we get a 4.94GB image.

There are multiple things that can be optimiced in the Dockerfile. The most important one is that we are coping two big .zip in a layer and then we unzip and remove them at another layer. The problem of doing this is that the .zip is cached in the first layer so the image is ~1.4GB bigger than the needed size.

We have two options here:

  • Download the .zip in the Dockerfile, unzip it and remove it in the same RUN command
    • Cleaner, but we are forcing A LOT of dowloads
  • unzip the file before and copy the files unziped.
    • No that clean...

There is a thrid option and it's that the ADD command supports decompress .gz out of the box. So if we could download the data in .gz we could use this feature. But I don't know if the repository provides that format.

Unable to get video or images out of the box

So I have got the containers and images all up and running, but am unable to see any video or images on the React site.

I thought maybe this was due to the no-window flag used in launch-emulator.sh, but removing this flag ended up causing a Qt error, since it seems like not all the dependencies are installed in docker.

Is the video/image feature supposed to just work out of the box, with -no-window param set?

For reference, the error I am getting with Qt when running without -no-window is:

emulator: INFO: QtLogger.cpp:66: Info: Could not load the Qt platform plugin "xcb" in "/android/sdk/emulator/lib64/qt/plugins" even though it was found. ((null):0, (null))
emulator_1     | 
emulator_1     | 
emulator_1     | emulator: INFO: QtLogger.cpp:66: Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
emulator_1     | 
emulator_1     | Available platform plugins are: xcb.

which seems to be this error therecipe/qt#775.

Any insight is appreciated, thanks!

sorry for replying so late.

sorry for replying so late.

Screenshot from 2019-12-15 14-24-49

my flutter connect to docker 6a674e31b788 , and it run will.

but I can't see it.

I want show it in web, and, I docker-compose -f js/docker/docker-compose.yaml up
it look like ok

but I can't see it(flutter demo) still.

Originally posted by @huang12zheng in #78 (comment)

Encountered errors while bringing up the project.

When I execute the following command, it has the following error.

docker-compose -f js/docker/docker-compose.yaml up

 Removing docker_front-envoy_1
Removing docker_emulator_1
docker_nginx_1 is up-to-date
 docker_jwt_signer_1 is up-to-date
Recreating 6cf925d898fe_docker_front-envoy_1 ... 
Recreating f292c70dc48d_docker_emulator_1    ... error
 Recreating 6cf925d898fe_docker_front-envoy_1 ... done
ERROR: for f292c70dc48d_docker_emulator_1  Cannot start service emulator: error gathering device information while adding custom device "/dev/kvm": no such file or directory

ERROR: for emulator  Cannot start service emulator: error gathering device information while adding custom device "/dev/kvm": no such file or directory
 ERROR: Encountered errors while bringing up the project.

emu_downloads_menu.py

Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may 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.
Minimal dependency script to query a set of
publically available emulator and system image zip files.
import logging
import os
import re
import xml.etree.ElementTree as ET
import zipfile

import click
import urlfetch
from consolemenu import SelectionMenu
from tqdm import tqdm

from emu.docker_config import DockerConfig

SYSIMG_REPOS = [
"https://dl.google.com/android/repository/sys-img/android/sys-img2-1.xml",
"https://dl.google.com/android/repository/sys-img/google_apis/sys-img2-1.xml",
"https://dl.google.com/android/repository/sys-img/google_apis_playstore/sys-img2-1.xml",
]

EMU_REPOS = ["https://dl.google.com/android/repository/repository2-1.xml"]

CHANNEL_MAPPING = {"channel-0": "stable", "channel-1": "beta", "channel-2": "dev", "channel-3": "canary"}

API_LETTER_MAPPING = {
"10": "G",
"15": "I",
"16": "J",
"17": "J",
"18": "J",
"19": "K",
"21": "L",
"22": "L",
"23": "M",
"24": "N",
"25": "N",
"26": "O",
"27": "O",
"28": "P",
"29": "Q",
}

Older versions might not work as expected.
MIN_REL_I386 = "K"
MIN_REL_X64 = "O"

Platform tools, needed to get adb.
PLATFORM_TOOLS_URL = "https://dl.google.com/android/repository/platform-tools_r29.0.5-linux.zip"

def _download(url, dest):
"""Downloads the given url to the given destination with a progress bar.

This function will immediately return if the file already exists.
"""
if os.path.exists(dest):
print(" Skipping already downloaded file: {}".format(dest))
return dest
with urlfetch.get(url) as r:
with tqdm(r, total=int(r.headers["content-length"]), unit="B", unit_scale=True) as t:
with open(dest, "wb") as f:
for data in r:
f.write(data)
t.update(len(data))
return dest
class AndroidReleaseZip(object):
"""Provides information of released android products.

Every released zip file contains a source.properties file, this
source.properties file contains [key]=[value] pairs with information
about the contents of the zip.
"""

ABI_CPU_MAP = {"armeabi-v7a": "arm", "arm64-v8a": "arm64", "x86_64": "x86_64", "x86": "x86"}
SHORT_MAP = {"armeabi-v7a": "a32", "arm64-v8a": "a64", "x86_64": "x64", "x86": "x86"}
SHORT_TAG = {"android": "aosp", "google_apis": "google", "google_apis_playstore": "playstore"}

def init(self, fname):
self.fname = fname
if not zipfile.is_zipfile(fname):
raise Exception("{} is not a zipfile!".format(fname))
with zipfile.ZipFile(fname, "r") as sysimg:
props = [x for x in sysimg.infolist() if "source.properties" in x.filename]
if not props:
raise Exception("{} does not contain source.properties!".format(fname))
prop = sysimg.read(props[0]).decode("utf-8").splitlines()
self.props = dict([a.split("=") for a in prop if "=" in a])

def str(self):
return "{}-{}".format(self.desc(), self.revision())

def api(self):
"""The api level, if any."""
return self.props.get("AndroidVersion.ApiLevel", "")

def codename(self):
"""First letter of the desert, if any."""
api = self.api()
if api in API_LETTER_MAPPING:
return API_LETTER_MAPPING[api]
else:
return "_"

def abi(self):
"""The abi if any."""
return self.props.get("SystemImage.Abi", "")

def short_abi(self):
return self.SHORT_MAP[self.abi()]

def cpu(self):
"""Returns the cpu architecture, derived from the abi."""
return self.ABI_CPU_MAP[self.abi()]

def gpu(self):
"""Returns whether or not the system has gpu support."""
return self.props.get("SystemImage.GpuSupport")

def tag(self):
"""The tag associated with this release."""
tag = self.props.get("SystemImage.TagId", "")
if tag == "default":
tag = "android"
return tag

def short_tag(self):
return self.SHORT_TAG[self.tag()]

def desc(self):
"""Descripton of this release."""
return self.props.get("Pkg.Desc")

def revision(self):
"""The revision of this release."""
return self.props.get("Pkg.Revision")

def build_id(self):
"""The build id, or revision of build id is not available."""
if "Pgk.BuildId" in self.props:
return self.props.get("Pkg.BuildId")
return self.revision()

def repo_friendly_name(self):
return "{}-{}-{}".format(self.codename().lower(), self.short_tag(), self.short_abi())

def is_system_image(self):
return "System Image" in self.desc()

def is_emulator(self):
return "Android Emulator" in self.desc()

def logger_flags(self):
if "arm" in self.cpu():
return "-logcat *:V -show-kernel"
else:
return "-shell-serial file:/tmp/android-unknown/kernel.log -logcat-output /tmp/android-unknown/logcat.log"
class PlatformTools(object):
"""The platform tools zip file. It will be downloaded on demand."""

def init(self, fname=None):
self.platform = fname

def extract_adb(self, dest):
if not self.platform:
self.platform = self.download()
with zipfile.ZipFile(self.platform, "r") as plzip:
plzip.extract("platform-tools/adb", dest)

def download(self, dest=None):
dest = dest or os.path.join(os.getcwd(), "platform-tools-latest-linux.zip")
print("Downloading platform tools to {}".format(dest))
return _download(PLATFORM_TOOLS_URL, dest)
class License(object):
"""Represents a license."""

def init(self, license):
self.name = license.attrib["id"]
self.text = license.text
self.cfg = DockerConfig()

def accept(self):
agree = "\n\n".join([self.text, "Do you accept the license?"])
if not self.is_accepted():
if not click.confirm(agree):
raise Exception("License not accepted.")
self.cfg.accept_license(self.name)

return True

def is_accepted(self):
return self.cfg.accepted_license(self.name)

def force_accept(self):
self.cfg.accept_license(self.name)

def str(self):
return self.text

def hash(self):
return hash(self.name)

def eq(self, other):
return self.class == other.class and self.name == other.name
class LicensedObject(object):
"""A dowloadable object for which a license needs to be accepted."""

def init(self, pkg, licenses):
self.license = licenses[pkg.find("uses-license").attrib["ref"]]

def download(self, url, dest):
""""Downloads the released pacakage forto the dest."""
if self.license.accept():
return _download(url, dest)
class SysImgInfo(LicensedObject):
"""Provides information about a released system image."""

def init(self, pkg, licenses):
super(SysImgInfo, self).init(pkg, licenses)
details = pkg.find("type-details")
self.api = details.find("api-level").text

codename = details.find("codename")
if codename is None:
    if self.api in API_LETTER_MAPPING:
        self.letter = API_LETTER_MAPPING[self.api]
    else:
        self.letter = "_"
else:
    self.letter = codename.text

self.tag = details.find("tag").find("id").text

if self.tag == "default":
    self.tag = "android"
self.abi = details.find("abi").text
self.zip = pkg.find(".//url").text
self.url = "https://dl.google.com/android/repository/sys-img/%s/%s" % (self.tag, self.zip)

def download(self, dest=None):
dest = dest or os.path.join(
os.getcwd(), "sys-img-{}-{}-{}-{}.zip".format(self.tag, self.api, self.letter, self.abi)
)
print("Downloading system image: {} {} {} {} to {}".format(self.tag, self.api, self.letter, self.abi, dest))
return super(SysImgInfo, self).download(self.url, dest)

def str(self):
return "{} {} {}".format(self.letter, self.tag, self.abi)
class EmuInfo(LicensedObject):
"""Provides information about a released emulator."""

def init(self, pkg, licenses):
super(EmuInfo, self).init(pkg, licenses)
rev = pkg.find("revision")

rev_major = rev.find("major").text
rev_minor = rev.find("minor").text
rev_micro = rev.find("micro").text

archives = pkg.find("archives")
channel = pkg.find("channelRef")

self.channel = CHANNEL_MAPPING[channel.attrib["ref"]]

self.version = "%s.%s.%s" % (rev_major, rev_minor, rev_micro)
self.urls = {}

for archive in archives:
    url = archive.find(".//url").text
    hostos = archive.find("host-os").text
    self.urls[hostos] = "https://dl.google.com/android/repository/%s" % url

def download(self, hostos="linux", dest=None):
""""Downloads the released pacakage for the given os to the dest."""
dest = dest or os.path.join(os.getcwd(), "emulator-{}.zip".format(self.version))
print("Downloading emulator: {} {} to {}".format(self.channel, self.version, dest))
return super(EmuInfo, self).download(self.urls[hostos], dest)

def str(self):
return "{} {}".format(self.channel, self.version)
def get_images_info(arm=False):
"""Gets all the publicly available system images from the Android Image Repos.

Returns a list of AndroidSystemImages that were found and (hopefully) can boot."""
xml = []
for url in SYSIMG_REPOS:
response = urlfetch.get(url)
if response.status == 200:
xml.append(response.content)

licenses = [License(p) for x in xml for p in ET.fromstring(x).findall("license")]
licenses = dict([(x.name, x) for x in [y for y in licenses]])

xml = [ET.fromstring(x).findall("remotePackage") for x in xml]

Flatten the list of lists into a system image objects.

infos = [SysImgInfo(item, licenses) for sublist in xml for item in sublist]

Filter only for intel images that we know that work

x86_64_imgs = [info for info in infos if info.abi == "x86_64" and info.letter >= MIN_REL_X64]
x86_imgs = [info for info in infos if info.abi == "x86" and info.letter >= MIN_REL_I386]
slow = []
if arm:
slow = [info for info in infos if info.abi.startswith("arm")]
all_imgs = sorted(x86_64_imgs + x86_imgs + slow, key=lambda x: x.api + x.tag)

Filter out windows/darwin images.

return [i for i in all_imgs if "windows" not in i.url and "darwin" not in i.url]
def find_image(regexpr):
reg = re.compile(regexpr)
all_images = get_images_info(True)
matches = [img for img in all_images if reg.match(str(img))]
logging.info(
"Found %s matching images: %s from %s", regexpr, [str(x) for x in matches], [str(x) for x in all_images]
)
if not matches:
raise Exception(
"No system image found matching {}. Run the list command to list available images".format(regexpr)
)
return matches

def find_emulator(channel):
"""Displayes an interactive menu to select a released emulator binary.

Returns a ImuInfo object with the choice or None if the user aborts. """
emu_infos = [x for x in get_emus_info() if "linux" in x.urls and (channel == "all" or x.channel == channel)]
logging.info("Found %s matching images: %s", channel, [str(x) for x in emu_infos])
if not emu_infos:
raise Exception("No emulator found in channel {}".format(channel))
return emu_infos
def get_emus_info():
"""Gets all the publicly available emulator builds.

 Returns a list of EmuInfo items that were found.    """

xml = []
for url in EMU_REPOS:
response = urlfetch.get(url)
if response.status == 200:
xml.append(response.content)

licenses = [License(p) for x in xml for p in ET.fromstring(x).findall("license")]
licenses = dict([(x.name, x) for x in [y for y in licenses]])
xml = [[p for p in ET.fromstring(x).findall("remotePackage") if "emulator" == p.attrib["path"]] for x in xml]

Flatten the list of lists into a system image objects.

infos = [EmuInfo(item, licenses) for sublist in xml for item in sublist]
return infos
def select_image(arm):
"""Displayes an interactive menu to select a released system image.

Returns a SysImgInfo object with the choice or None if the user aborts. """
img_infos = get_images_info(arm)
display = [
"{} {} {} ({})".format(img_info.api, img_info.letter, img_info.tag, img_info.abi) for img_info in img_infos
]
selection = SelectionMenu.get_selection(display, title="Select the system image you wish to use:")
return img_infos[selection] if selection < len(img_infos) else None
def select_emulator():
"""Displayes an interactive menu to select a released emulator binary.

Returns a ImuInfo object with the choice or None if the user aborts. """
emu_infos = [x for x in get_emus_info() if "linux" in x.urls]
display = ["EMU {} {}".format(emu_info.channel, emu_info.version) for emu_info in emu_infos]
selection = SelectionMenu.get_selection(display, title="Select the emulator you wish to use:")
return emu_infos[selection] if selection < len(emu_infos) else None
def list_all_downloads(arm):
"""Lists all available downloads that can be used to construct a Docker image."""
img_infos = get_images_info(arm)
emu_infos = get_emus_info()

for img_info in img_infos:
print("SYSIMG {} {} {} {} {}".format(img_info.api, img_info.letter, img_info.tag, img_info.abi, img_info.url))

for emu_info in emu_infos:
for (hostos, url) in list(emu_info.urls.items()):
print("EMU {} {} {} {}".format(emu_info.channel, emu_info.version, hostos, url))

Adb reverse commands not working

Setting up reverse proxy on an android emulator running inside docker is not working. I keep getting
error: more than one device/emulator error .

I am using run.sh to start the container. Here is the command I use to setup reverse proxy

$ adb devices
List of devices attached
localhost:5555	device

$ adb reverse tcp:50051 tcp:50051
error: more than one device/emulator

$ adb -s localhost:5555 reverse tcp:50051 tcp:50051
error: more than one device/emulator

Don't install the recommends

It's usually good to execute apt-get install with the flag --no-install-recommends. I did some tests and we would reduce the size of the images around 130MB. And it improves the build time of the images too.

The problem here is that we are installing less things so it's possible to break something... I think that we should add the flag and test the images because:

  • If we are not using those dependencies we don't want them in the image
  • If we are using some of them we should be explicit in the Dockerfile

What do you think?

Hash Sum mismatch

Due to my networking misconfiguration it couldn't build jwt_signer for me:

Automatically disabled Acquire::http::Pipeline-Depth due to incorrect response from server/proxy
...
Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/p/python-defaults/libpython-stdlib_2.7.13-2_amd64.deb Hash Sum mismatch

In case somebody find it useful appending /etc/apt/apt.conf with these two lines solved my problem:

Acquire::http::Pipeline-Depth 0;
Acquire::http::No-Cache true;

Tweak in relevant Dockerfile:

diff --git a/js/jwt-provider/Dockerfile b/js/jwt-provider/Dockerfile
index 66d5f18..87b630a 100644
--- a/js/jwt-provider/Dockerfile
+++ b/js/jwt-provider/Dockerfile
@@ -13,6 +13,8 @@
 # limitations under the License.
 FROM debian:stretch-slim
 RUN apt-get update -y
+RUN echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf
+RUN echo "Acquire::http::Pipeline-Depth 0;" >> /etc/apt/apt.conf
 RUN apt-get install -y python-pip python-dev build-essential
 COPY . /app
 WORKDIR /app

Run images on MacOSX

I can't run the images created by this repo on my MacBook Pro. I get this error:

emulator: CPU Acceleration: DISABLED
emulator: CPU Acceleration status: KVM requires a CPU that supports vmx or svm
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: KVM requires a CPU that supports vmx or svm
More info on configuring VM acceleration on Linux:
https://developer.android.com/studio/run/emulator-acceleration#vm-linux
General information on acceleration: https://developer.android.com/studio/run/emulator-acceleration.

As far as I know KVM doesn't exist on MacOSX. Could we use HAXM here? How?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.