Home > Mobile >  Run thyrlian / AndroidSDK docker image on Mac
Run thyrlian / AndroidSDK docker image on Mac

Time:06-30

As the title says, I'm trying to get thyrlian / AndroidSDK running on Mac — specifically:

  • macOS Monterey 12.4
  • Intel Core i7
  • docker desktop 4.6.1

There's a set of instructions on Medium that's a couple of years old and has a couple of typos, but has gotten me quite close.

Both the regular and the VNC enabled docker images seems to work fine. sdkmanager seems to have successfully downloaded "platform-tools" "platforms;android-24" "platforms;android-25" and "emulator", as well as two specific armeabi images, "system-images;android-24;default;armeabi-v7a" and "system-images;android-25;google_apis;armeabi-v7a".

avdmanager successfully creates both new virtual devices:

$ avdmanager create avd -n android-24-default -k "system-images;android-24;default;armeabi-v7a"
$ avdmanager create avd -n armeabi-v7a -k "system-images;android-25;google_apis;armeabi-v7a"
$ avdmanager list avd
Available Android Virtual Devices:
    Name: android-24-default
    Path: /root/.android/avd/android-24-default.avd
  Target: 
          Based on: Android 7.0 (Nougat) Tag/ABI: default/armeabi-v7a
  Sdcard: 512 MB
---------
    Name: armeabi-v7a
    Path: /root/.android/avd/armeabi-v7a.avd
  Target: Google APIs (Google Inc.)
          Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/armeabi-v7a
  Sdcard: 512 MB

But the emulators don't seem to run properly. The actual behavior is, if I log into VNC, I have a "shell" (the outline of a phone) and controls, but nothing inside of the shell (it's just black or grey), and if I click on anything, it crashes.

There are two hints along the way. First, during startup, it throws a bunch of warnings:

Warning: QXcbConnection: XCB error: 2 (BadValue), sequence: 245, resource id: 4, major code: 53 (CreatePixmap), minor code: 0 ((null):0, (null))

(full startup log at end). At this point, it thinks it's running:

$ adb devices
List of devices attached
emulator-5554   device

Second, when I click on anything in the VNC client it crashes with

ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

That See references a PR from 2016, which is 2 years before the Medium article was written, so I presume this wasn't directly an issue, and something else has gone wrong.

The git repository seems fairly active (last updated 6 days ago, almost 1,000 stars, several hundred forks), so, has anyone gotten this running on Mac? Any ideas what I need to do?

Full emulator start log:

INFO    | Android emulator version 31.2.10.0 (build_id 8420304) (CL:N/A)
WARNING | encryption is off
INFO    | Warning: XKeyboard extension not present on the X server ((null):0, (null))

WARNING | NativeEventFilter: warning: cannot get mod mask info
WARNING | could not find /usr/share/zoneinfo/ directory. unable to determine host timezone
INFO    | Started GRPC server at 127.0.0.1:8554, security: Local
WARNING | Using fallback path for the emulator registration directory.
INFO    | Advertising in: /root/.android/avd/running/pid_2932.ini
INFO    | Warning: QXcbConnection: XCB error: 2 (BadValue), sequence: 245, resource id: 4, major code: 53 (CreatePixmap), minor code: 0 ((null):0, (null))

INFO    | Warning: QXcbConnection: XCB error: 4 (BadPixmap), sequence: 246, resource id: 71303169, major code: 54 (FreePixmap), minor code: 0 ((null):0, (null))

INFO    | Warning: QXcbConnection: XCB error: 2 (BadValue), sequence: 247, resource id: 8, major code: 53 (CreatePixmap), minor code: 0 ((null):0, (null))

INFO    | Warning: QXcbConnection: XCB error: 4 (BadPixmap), sequence: 248, resource id: 71303178, major code: 54 (FreePixmap), minor code: 0 ((null):0, (null))

INFO    | Warning: QXcbConnection: XCB error: 2 (BadValue), sequence: 249, resource id: 32, major code: 53 (CreatePixmap), minor code: 0 ((null):0, (null))

INFO    | Warning: QXcbConnection: XCB error: 4 (BadPixmap), sequence: 250, resource id: 71303179, major code: 54 (FreePixmap), minor code: 0 ((null):0, (null))
WARNING | could not find /usr/share/zoneinfo/ directory. unable to determine host timezone

CodePudding user response:

-gpu swiftshader_indirect option in the emulator launch command is the key:

emulator -avd armeabi-v7a -no-audio -no-boot-anim -accel on -gpu swiftshader_indirect &

Here is the GitHub discussion

  • Related