vgaidarji / docker-android

Docker image for Android projects
Apache License 2.0
35 stars 20 forks source link

Fix issue with Android emulator not being started #11

Open vgaidarji opened 4 years ago

vgaidarji commented 4 years ago

After Android SDK and tools update in https://github.com/vgaidarji/docker-android/releases/tag/v1.0.1, emulator cannot be started and following error is thrown to console:

Running /opt/android-sdk/tools/bin/avdmanager list avd

Available Android Virtual Devices:
    Name: test
    Path: /root/.android/.android/avd/test.avd
  Target: Google APIs (Google Inc.)
          Based on: Android 5.0 (Lollipop) Tag/ABI: google_apis/armeabi-v7a
emulator:Auto-config: -force-32bit (ANDROID_EMULATOR_FORCE_32BIT=true)
emulator:Android emulator version 26.0.3.0 (build_id 3965150)
PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT
emulator:Found AVD name 'test'
emulator:Found AVD target architecture: arm
emulator:argv[0]: '/opt/android-sdk/tools/emulator'; program directory: '/opt/android-sdk/tools'
emulator:Cannot find system image path. Please define ANDROID_SDK_ROOT
emulator:Auto-config: -engine classic (based on configuration)
##[error]The operation was canceled.

➡️ Related issue https://github.com/google/android-emulator-container-scripts/issues/21

giorgosneokleous93 commented 4 years ago

Put a PR for this: https://github.com/vgaidarji/docker-android/pull/12

vgaidarji commented 4 years ago

arm emulator worked before, x84 and x86_64 not working. Latest attempt is here, still something is missing.

docker build docker-android-emulator . ``` Sending build context to Docker daemon 23.55kB Step 1/18 : FROM docker-android-build-local:latest ---> dae329dccb24 Step 2/18 : RUN yes | sdkmanager "build-tools;29.0.3" ---> Using cache ---> d294080a411d Step 3/18 : RUN sdkmanager "platform-tools" ---> Using cache ---> 845c54efa492 Step 4/18 : RUN yes | sdkmanager "platforms;android-29" ---> Using cache ---> d9625175597f Step 5/18 : RUN curl -fo emulator.zip https://dl.google.com/android/repository/emulator-linux-6061023.zip ---> Using cache ---> 9b9b0f6eec43 Step 6/18 : RUN rm -rf ${ANDROID_HOME}/emulator ---> Using cache ---> 20ba738b5a96 Step 7/18 : RUN unzip -q emulator.zip -d ${ANDROID_HOME} ---> Using cache ---> 71c95e141520 Step 8/18 : RUN rm -f emulator.zip ---> Using cache ---> 6b85246d6454 Step 9/18 : RUN sdkmanager "system-images;android-29;default;x86" ---> Using cache ---> 0d6c402a0728 Step 10/18 : ENV ANDROID_EMULATOR_FORCE_32BIT=true ---> Using cache ---> a35b2ea6117c Step 11/18 : COPY ui-tests-on-emulator.sh /usr/bin/ui-tests-on-emulator ---> 56d80b4532d8 Step 12/18 : COPY run-ui-tests.sh /usr/bin/run-ui-tests ---> 74fca5d0f5e6 Step 13/18 : COPY kill-running-emulators.sh /usr/bin/kill-running-emulators ---> 92f85e82214a Step 14/18 : COPY wait-for-emulator.sh /usr/bin/wait-for-emulator ---> 2eab7f494227 Step 15/18 : COPY unlock-emulator-screen.sh /usr/bin/unlock-emulator-screen ---> 40a34fb38685 Step 16/18 : COPY entrypoint.sh / ---> 584af6b29756 Step 17/18 : ENTRYPOINT ["/entrypoint.sh"] ---> Running in c39ba22b86d4 Removing intermediate container c39ba22b86d4 ---> c53d16f7f1ac Step 18/18 : CMD ["ui-tests-on-emulator"] ---> Running in 11f2f784c6c4 Removing intermediate container 11f2f784c6c4 ---> f7bcf78bc691 Successfully built f7bcf78bc691 Successfully tagged docker-android-emulator:latest ```
docker run docker-android-emulator ``` Loading local repository... [========= ] 25% Loading local repository... [========= ] 25% Fetch remote repository... [========= ] 25% Fetch remote repository... [========= ] 25% Fetch remote repository... [=======================================] 100% Fetch remote repository... Do you wish to create a custom hardware profile? [no] ************************************************************************* The "android" command is deprecated. For manual SDK, AVD, and project management, please use Android Studio. For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager ************************************************************************* Running /opt/android-sdk/tools/bin/avdmanager list avd Available Android Virtual Devices: Name: test Path: /root/.android/avd/test.avd Target: Default Android System Image Based on: Android API 29 Tag/ABI: default/x86 Waiting for emulator to start emulator: autoconfig: -skin HVGA emulator: autoconfig: -skindir (null) emulator: autoconfig: -kernel /opt/android-sdk/system-images/android-29/default/x86//kernel-ranchu-64 emulator: Target arch = 'x86' emulator: Auto-config: -qemu -cpu qemu32 emulator: Auto-detect: Kernel image requires new device naming scheme. emulator: Auto-detect: Kernel does not support YAFFS2 partitions. emulator: autoconfig: -ramdisk /opt/android-sdk/system-images/android-29/default/x86//ramdisk.img emulator: Using initial system image: /opt/android-sdk/system-images/android-29/default/x86//system.img emulator: Using initial vendor image: /opt/android-sdk/system-images/android-29/default/x86//vendor.img emulator: autoconfig: -initdata /root/.android/avd/test.avd/userdata.img emulator: autoconfig: -cache /root/.android/avd/test.avd/cache.img emulator: Increasing RAM size to 2048MB emulator: VM heap size 0MB is below hardware specified minimum of 512MB,setting it to that value emulator: System image is read only emulator: Found 1 DNS servers: 192.168.65.1 emulator: skin name 'HVGA' aliased to '320x480' emulator: found magic skin width=320 height=480 bpp=16 emulator: VERBOSE: System.cpp:2345: statvfs('/root/.android/avd/test.avd/snapshots/default_boot/ram.img') failed: No such file or directory emulator: registered 'boot-properties' qemud service emulator: Adding boot property: 'qemu.cmdline' = 'androidboot.logcat=v:* androidboot.consolepipe=qemu_pipe,pipe:logcat' emulator: Adding boot property: 'qemu.logcat' = 'start' emulator: Creating ext4 userdata partition: /root/.android/avd/test.avd/data Creating filesystem with parameters: Size: 838860800 Block size: 4096 Blocks per group: 32768 Inodes per group: 7328 Inode size: 256 Journal blocks: 3200 Label: Blocks: 204800 Block groups: 7 Reserved block group size: 55 Created filesystem with 19/51296 inodes and 6660/204800 blocks emulator: Creating empty ext4 cache partition: /root/.android/avd/test.avd/cache.img Creating filesystem with parameters: Size: 69206016 Block size: 4096 Blocks per group: 32768 Inodes per group: 4224 Inode size: 256 Journal blocks: 1024 Label: Blocks: 16896 Block groups: 1 Reserved block group size: 7 Created filesystem with 11/4224 inodes and 1302/16896 blocks emulator: CPU Acceleration: DISABLED emulator: CPU Acceleration status: KVM requires a CPU that supports vmx or svm emulator: WARNING: x86 emulation may not work without hardware acceleration! emulator: VERBOSE: AdbInterface.cpp:385: Found: 3 adb executables emulator: VERBOSE: AdbInterface.cpp:387: Adb: /opt/android-sdk/platform-tools/adb emulator: VERBOSE: AdbInterface.cpp:387: Adb: /opt/android-sdk/platform-tools/adb emulator: VERBOSE: AdbInterface.cpp:387: Adb: /opt/android-sdk/platform-tools/adb emulator: VERBOSE: AdbInterface.cpp:408: Path:/opt/android-sdk/platform-tools/adb protocol version: 41 emulator: VERBOSE: AdbInterface.cpp:408: Path:/opt/android-sdk/platform-tools/adb protocol version: 41 emulator: VERBOSE: AdbInterface.cpp:408: Path:/opt/android-sdk/platform-tools/adb protocol version: 41 emulator: WARNING: Your AVD has been configured with an in-guest renderer, but the system image does not support guest rendering.Falling back to 'swiftshader_indirect' mode. emulator: GPU emulation enabled using 'swiftshader_indirect' mode emulator: Initializing hardware OpenGLES emulation support emulator: Found 1 DNS servers: 192.168.65.1 Content of hardware configuration file: hw.cpu.arch = x86 hw.cpu.model = qemu32 hw.cpu.ncore = 2 hw.ramSize = 2048 hw.screen = multi-touch hw.mainKeys = true hw.trackBall = true hw.keyboard = false hw.keyboard.lid = false hw.keyboard.charmap = qwerty2 hw.dPad = true hw.rotaryInput = false hw.gsmModem = true hw.gps = true hw.battery = true hw.accelerometer = true hw.gyroscope = true hw.audioInput = true hw.audioOutput = true hw.sdCard = true disk.cachePartition = true disk.cachePartition.path = /root/.android/avd/test.avd/cache.img disk.cachePartition.size = 66m test.quitAfterBootTimeOut = -1 test.delayAdbTillBootComplete = 0 test.monitorAdb = 0 hw.lcd.width = 320 hw.lcd.height = 480 hw.lcd.depth = 16 hw.lcd.density = 160 hw.lcd.backlight = true hw.lcd.vsync = 60 hw.gltransport = pipe hw.gltransport.asg.writeBufferSize = 1048576 hw.gltransport.asg.writeStepSize = 4096 hw.gltransport.asg.dataRingSize = 32768 hw.gltransport.drawFlushInterval = 800 hw.displayRegion.0.1.xOffset = -1 hw.displayRegion.0.1.yOffset = -1 hw.displayRegion.0.1.width = 0 hw.displayRegion.0.1.height = 0 hw.fold.adjust = false hw.display1.width = 0 hw.display1.height = 0 hw.display1.density = 0 hw.display1.xOffset = -1 hw.display1.yOffset = -1 hw.display1.flag = 0 hw.display2.width = 0 hw.display2.height = 0 hw.display2.density = 0 hw.display2.xOffset = -1 hw.display2.yOffset = -1 hw.display2.flag = 0 hw.display3.width = 0 hw.display3.height = 0 hw.display3.density = 0 hw.display3.xOffset = -1 hw.display3.yOffset = -1 hw.display3.flag = 0 hw.gpu.enabled = true hw.gpu.mode = swiftshader_indirect hw.initialOrientation = portrait hw.camera.back = emulated hw.camera.front = none vm.heapSize = 512 hw.sensors.light = true hw.sensors.pressure = true hw.sensors.humidity = true hw.sensors.proximity = true hw.sensors.magnetic_field = true hw.sensors.magnetic_field_uncalibrated = true hw.sensors.gyroscope_uncalibrated = true hw.sensors.orientation = true hw.sensors.temperature = true hw.useext4 = true hw.arc = false hw.arc.autologin = false kernel.path = /opt/android-sdk/system-images/android-29/default/x86//kernel-ranchu-64 kernel.newDeviceNaming = yes kernel.supportsYaffs2 = no disk.ramdisk.path = /opt/android-sdk/system-images/android-29/default/x86//ramdisk.img disk.systemPartition.initPath = /opt/android-sdk/system-images/android-29/default/x86//system.img disk.systemPartition.size = 3083m disk.vendorPartition.initPath = /opt/android-sdk/system-images/android-29/default/x86//vendor.img disk.vendorPartition.size = 800m disk.dataPartition.path = /root/.android/avd/test.avd/userdata-qemu.img disk.dataPartition.initPath = /root/.android/avd/test.avd/userdata.img disk.dataPartition.size = 800m disk.encryptionKeyPartition.path = /root/.android/avd/test.avd/encryptionkey.img PlayStore.enabled = false avd.name = test avd.id = test fastboot.forceColdBoot = false android.sdk.root = /opt/android-sdk android.avd.home = /root/.android/avd . QEMU options list: emulator: argv[00] = "/opt/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64-headless" emulator: argv[01] = "-dns-server" emulator: argv[02] = "192.168.65.1" emulator: argv[03] = "-no-audio" emulator: argv[04] = "-mem-path" emulator: argv[05] = "/root/.android/avd/test.avd/snapshots/default_boot/ram.img" emulator: argv[06] = "-serial" emulator: argv[07] = "null" emulator: argv[08] = "-device" emulator: argv[09] = "goldfish_pstore,addr=0xff018000,size=0x10000,file=/root/.android/avd/test.avd/data/misc/pstore/pstore.bin" emulator: argv[10] = "-cpu" emulator: argv[11] = "android64" emulator: argv[12] = "-smp" emulator: argv[13] = "cores=2" emulator: argv[14] = "-m" emulator: argv[15] = "2048" emulator: argv[16] = "-lcd-density" emulator: argv[17] = "160" emulator: argv[18] = "-object" emulator: argv[19] = "iothread,id=disk-iothread" emulator: argv[20] = "-nodefaults" emulator: argv[21] = "-kernel" emulator: argv[22] = "/opt/android-sdk/system-images/android-29/default/x86//kernel-ranchu-64" emulator: argv[23] = "-initrd" emulator: argv[24] = "/opt/android-sdk/system-images/android-29/default/x86//ramdisk.img" emulator: argv[25] = "-drive" emulator: argv[26] = "if=none,index=0,id=system,file=/opt/android-sdk/system-images/android-29/default/x86//system.img,read-only" emulator: argv[27] = "-device" emulator: argv[28] = "virtio-blk-pci,drive=system,iothread=disk-iothread,modern-pio-notify" emulator: argv[29] = "-drive" emulator: argv[30] = "if=none,index=1,id=cache,file=/root/.android/avd/test.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576" emulator: argv[31] = "-device" emulator: argv[32] = "virtio-blk-pci,drive=cache,iothread=disk-iothread,modern-pio-notify" emulator: argv[33] = "-drive" emulator: argv[34] = "if=none,index=2,id=userdata,file=/root/.android/avd/test.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576" emulator: argv[35] = "-device" emulator: argv[36] = "virtio-blk-pci,drive=userdata,iothread=disk-iothread,modern-pio-notify" emulator: argv[37] = "-drive" emulator: argv[38] = "if=none,index=3,id=encrypt,file=/root/.android/avd/test.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576" emulator: argv[39] = "-device" emulator: argv[40] = "virtio-blk-pci,drive=encrypt,iothread=disk-iothread,modern-pio-notify" emulator: argv[41] = "-drive" emulator: argv[42] = "if=none,index=4,id=vendor,file=/opt/android-sdk/system-images/android-29/default/x86//vendor.img,read-only" emulator: argv[43] = "-device" emulator: argv[44] = "virtio-blk-pci,drive=vendor,iothread=disk-iothread,modern-pio-notify" emulator: argv[45] = "-netdev" emulator: argv[46] = "user,id=mynet" emulator: argv[47] = "-device" emulator: argv[48] = "virtio-net-pci,netdev=mynet" emulator: argv[49] = "-device" emulator: argv[50] = "virtio-rng-pci" emulator: argv[51] = "-show-cursor" emulator: argv[52] = "-L" emulator: argv[53] = "/opt/android-sdk/emulator/lib/pc-bios" emulator: argv[54] = "-soundhw" emulator: argv[55] = "hda" emulator: argv[56] = "-vga" emulator: argv[57] = "none" emulator: argv[58] = "-append" emulator: argv[59] = "qemu=1 no_timer_check androidboot.hardware=ranchu androidboot.serialno=EMULATOR30X0X5X0 clocksource=pit no-kvmclock android.qemud=1 console=0 android.checkjni=1 android.bootanim=0 qemu.gles=1 qemu.settings.system.screen_off_timeout=2147483647 qemu.encrypt=1 qemu.vsync=60 qemu.gltransport=pipe qemu.gltransport.drawFlushInterval=800 qemu.opengles.version=131072 cma=260M@0-4G qemu.wifi=1 mac80211_hwsim.channels=2 loop.max_part=7 androidboot.vbmeta.size=4352 androidboot.vbmeta.hash_alg=sha256 androidboot.vbmeta.digest=25004a72b4aa375e392f237a50b23bd1e10e45a78dc6c9293ce7c0a6aa32f064 androidboot.boot_devices=pci0000:00/0000:00:03.0 ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=512m" emulator: argv[60] = "-android-hw" emulator: argv[61] = "/root/.android/avd/test.avd/hardware-qemu.ini" Concatenated QEMU options: /opt/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64-headless -dns-server 192.168.65.1 -no-audio -mem-path /root/.android/avd/test.avd/snapshots/default_boot/ram.img -serial null -device goldfish_pstore,addr=0xff018000,size=0x10000,file=/root/.android/avd/test.avd/data/misc/pstore/pstore.bin -cpu android64 -smp cores=2 -m 2048 -lcd-density 160 -object iothread,id=disk-iothread -nodefaults -kernel /opt/android-sdk/system-images/android-29/default/x86//kernel-ranchu-64 -initrd /opt/android-sdk/system-images/android-29/default/x86//ramdisk.img -drive if=none,index=0,id=system,file=/opt/android-sdk/system-images/android-29/default/x86//system.img,read-only -device virtio-blk-pci,drive=system,iothread=disk-iothread,modern-pio-notify -drive if=none,index=1,id=cache,file=/root/.android/avd/test.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=cache,iothread=disk-iothread,modern-pio-notify -drive if=none,index=2,id=userdata,file=/root/.android/avd/test.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=userdata,iothread=disk-iothread,modern-pio-notify -drive if=none,index=3,id=encrypt,file=/root/.android/avd/test.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=encrypt,iothread=disk-iothread,modern-pio-notify -drive if=none,index=4,id=vendor,file=/opt/android-sdk/system-images/android-29/default/x86//vendor.img,read-only -device virtio-blk-pci,drive=vendor,iothread=disk-iothread,modern-pio-notify -netdev user,id=mynet -device virtio-net-pci,netdev=mynet -device virtio-rng-pci -show-cursor -L /opt/android-sdk/emulator/lib/pc-bios -soundhw hda -vga none -append 'qemu=1 no_timer_check androidboot.hardware=ranchu androidboot.serialno=EMULATOR30X0X5X0 clocksource=pit no-kvmclock android.qemud=1 console=0 android.checkjni=1 android.bootanim=0 qemu.gles=1 qemu.settings.system.screen_off_timeout=2147483647 qemu.encrypt=1 qemu.vsync=60 qemu.gltransport=pipe qemu.gltransport.drawFlushInterval=800 qemu.opengles.version=131072 cma=260M@0-4G qemu.wifi=1 mac80211_hwsim.channels=2 loop.max_part=7 androidboot.vbmeta.size=4352 androidboot.vbmeta.hash_alg=sha256 androidboot.vbmeta.digest=25004a72b4aa375e392f237a50b23bd1e10e45a78dc6c9293ce7c0a6aa32f064 androidboot.boot_devices=pci0000:00/0000:00:03.0 ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=512m' -android-hw /root/.android/avd/test.avd/hardware-qemu.ini emulator: Android qemu version 30.0.5.0 (build_id 6306047) (CL:N/A) emulator: Starting QEMU main loop emulator: Adding boot property: 'ro.opengles.version' = '131072' emulator: Adding boot property: 'qemu.sf.fake_camera' = 'back' emulator: Adding boot property: 'dalvik.vm.heapsize' = '512m' emulator: Adding boot property: 'qemu.hw.mainkeys' = '1' emulator: Adding boot property: 'qemu.sf.lcd_density' = '160' emulator: goldfish_events.have-dpad: true emulator: goldfish_events.have-trackball: true emulator: goldfish_events.have-camera: true emulator: goldfish_events.have-keyboard: false emulator: goldfish_events.have-lidswitch: false emulator: goldfish_events.have-tabletmode: false emulator: goldfish_events.have-touch: false emulator: goldfish_events.have-multitouch: true emulator: control console listening on port 5554, ADB on port 5555 Not using any http proxy emulator: Adding boot property: 'qemu.timezone' = '/UTC' emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized emulator: emulator_window_fb_rotate emulator: No acpi ini file provided, using default emulator: Cold boot: requested by the user emulator: No acpi ini file provided, using default Waiting for emulator to start Your emulator is out of date, please update by launching Android Studio: - Start Android Studio - Select menu "Tools > Android > SDK Manager" - Click "SDK Tools" tab - Check "Android Emulator" checkbox - Click "OK" Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start Waiting for emulator to start emulator: onGuestSendCommand: [0x5063ba0] Adb connected, start proxing data emulator: _hwFingerprint_connect: connect finger print listen is called emulator: got message from guest system fingerprint HAL ```