imyjimmy
imyjimmy

Reputation: 731

Android Emulator Web Browser Needs Camera Permissions on macOS Catalina

I am in charge of testing a mobile-compliant website that also needs access to the device camera and microphone. I needed to expand the ability to test different Android devices, so I downloaded the Android SDK and created virtual devices. However, if I set the camera of any virtual device to "Webcam0" (to use my computer's webcam) and go to the url via the built in web browser, the entire emulator crashes immediately. macOS then generates the following report:

Process:               qemu-system-x86_64 [1487]
Path:                  /Users/USER/Library/Android/*/qemu-system-x86_64
Identifier:            qemu-system-x86_64
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        studio [1288]
Responsible:           studio [1288]
User ID:               673642719

Date/Time:             2020-04-29 11:50:56.314 -0400
OS Version:            Mac OS X 10.15.4 (19E287)
Report Version:        12
Bridge OS Version:     4.4 (17P4281)
Anonymous UUID:        B56B5142-EE7D-3D95-B70C-861201C1208B


Time Awake Since Boot: 2200 seconds

System Integrity Protection: enabled

Crashed Thread:        63  Dispatch queue: com.apple.root.default-qos

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace TCC, Code 0x0

The "Namespace TCC" points to a privacy issue. The new Catalina makes it v hard to access the camera (https://carlashley.com/2018/09/28/tcc-round-up/). I have googled how to work around the issue for Android development and the responses are something like the following:

If your app uses device cameras, include the NSCameraUsageDescription key in your app’s Info.plist file.

If your app uses device microphones, include the NSMicrophoneUsageDescription key in your app’s Info.plist file.

That's great for someone who is actually building a native Android App, but I just want to launch the Android emulator and use its default web browser to test a website.

  1. Is it overkill to use Android Emulator for this purpose? In other words, can I simply go to Dev Tools in Chrome desktop and resize the browser to the target dimensions of whatever Android device I want to test?

And

  1. If it were not overkill / I had to do it via the Emulator, how would I do it? My hunch is to build a custom Chromium apk with the NSCameraUsageDescription settings in Info.plist and put it into the emulator via instructions here: https://developers.google.com/web/t...er-browsers#chromium_content_shell_on_android but that would require pulling down Chromium and making a custom build.

Has anyone else gotten their android emulator web browser to access the webcam of on macOS Catalina? What were the steps?

Upvotes: 1

Views: 2022

Answers (1)

Michael Wlodawsky
Michael Wlodawsky

Reputation: 61

I was running into a similar issue trying to access the Camera from the Android Emulator. What I ended up having to do was following the steps listed here to run the emulator manually through the command line:

https://developer.android.com/studio/run/emulator-commandline

Only addition is you'll have to run the command with the sudo permissions.

Upvotes: 4

Related Questions