"mach android-emulator" with x86-6.0 and x86-7.0 does not work on macOS

RESOLVED FIXED in Firefox 62



Last year
Last year


(Reporter: robwu, Assigned: robwu)


Firefox 62
Firefox 62
Dependency tree / graph

Firefox Tracking Flags

(firefox62 fixed)



(1 attachment)

I ran "mach bootstrap" and selected Android, artifact mode. Then I modified the suggested mozconfig to target x86 (similar to the one at https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_for_Android_build):
ac_add_options --target=i386-linux-android

Upon running the following commands, I expected a working emulator:
mach android-emulator --version=x86
mach android-emulator --version=x86-6.0
mach android-emulator --version=x86-7.0

x86 starts (though "mach install" causes a segfault and the Android OS reboots. xpcshell tests run successfully.

x86-6.0 and x86-7.0 fails, however. The emulator's UI appears (but with black screen), and the launcher icon on my dock (macOS) has the icon of a folder instead of the emulator.

I debugged a lot and found a way to get around this (I'll attach a patch).

After applying my patch, the emulator can be launched via "mach android-emulator".

There are some other issues (below), but not blocking the workflow on macOS, so I'll just mention it for completeness.

- x86-6.0: Upon boot, "Unfortunately, Launcher3 has stopped" appears. I can dismiss (or ignore) the notification and run Firefox or tests as expected.

- x86-6.0 and x86-7.0: When the emulator starts, the following warning is shown:
> Cold boot: selected renderer 'swiftshader' doesn't support snapshots.
I did not experience any other obvious problems related to this. The renderer is set via the "-gpu swiftshader" option. The "swiftshader" options is also deprecated, by the way: https://developer.android.com/studio/run/emulator-acceleration#accel-graphics

- x86-6.0 and x86-7.0: "mach run" starts Firefox without issues. (yay)

- x86-6.0 and x86-7.0: "mach test path/to/xpcshell/tests" fails with SEGV, likely bug 1451930.

Test environment:
- macOS High Sierra (10.13.4)
- Freshly installed build tools via "mach bootstrap" and Firefox for Android, artifact builds.
- Android emulator version (build_id 4773671) (CL:18fc969f023e3b369b34b08db237dd9addfe100a)
- Firefox source checked out on 18 May 2018.
Comment on attachment 8979057 [details]
Bug 1462936 - Use QEMU 2 engine for android-emulator for x86-6.0 and x86-7.0


Thanks for this Rob. I don't have a macOS environment and wasn't aware of this issue. I verified your patch on Ubuntu 16.4 -- all's well.

I'll just mention 2 small concerns:
 - I'm sure I tried -engine qemu2 on ubuntu 16.4 a few months ago and found that Android would not boot.
 - https://developer.android.com/studio/run/emulator-commandline says:

Specify the emulator engine:

    auto - Automatically select an engine (default).
    classic - Use the older QEMU 1 engine.
    qemu2 - Use the newer QEMU 2 engine.

For example:

$ emulator @Nexus_5X_API_23 -engine auto

Auto-detection should choose the value that provides the best performance when emulating a particular AVD. You should use the -engine option for debugging and comparison purposes only.

...but if we really need qemu2 on macOS, then we need it!
Attachment #8979057 - Flags: review?(gbrown) → review+
Pushed by rob@robwu.nl:
Use QEMU 2 engine for android-emulator for x86-6.0 and x86-7.0 r=gbrown
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → Firefox 62
You need to log in before you can comment on or make changes to this bug.