Android AVD 与“模拟”相机显示根本没有相机
我使用 avdmanager
和 emulator
模拟 Android,我发现当我将相机配置为 emulated
时,模拟器中不会出现相机控件。但是,当我将相机设置为virtualscene
时,我确实获得了相机控制。
我需要做什么才能获得“模拟”相机?我希望能够指定一个图像(但不必通过虚拟机导航才能将该图像放入我的相机中,因为“虚拟场景”需要我)。我没有安装 Android Studio,只安装了命令行工具。
这是我的 avd 配置文件 (~/.android/avd/y.avd/config.ini
) 的相关部分:
hw.camera.back = virtualscene
hw.camera.front = emulated
在此示例中,我使用 Android API 30 标签模拟了 Pixel C /ABI:google_apis/x86。
I'm emulating Android with avdmanager
and emulator
, and I find that when I configure a camera as emulated
, no camera control appears in the emulator. However, I do get a camera control when I set the camera to virtualscene
.
What do I need to do to get an 'emulated' camera? I'd like to be able to specify an image (but not have to navigate through a virtual machine in order to place that image into my camera, as 'virtualscene' requires of me). I don't have Android Studio installed, just the command line tools.
This is the relevant part of my avd's config file (~/.android/avd/y.avd/config.ini
):
hw.camera.back = virtualscene
hw.camera.front = emulated
In this example, I've emulated a Pixel C with Android API 30 Tag/ABI: google_apis/x86.
You can see a camera menu item in this image, which represents my 'virtualscene' config.
You can see NO camera menu item in this image, which represents my 'emulated' config.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的模拟器的菜单也不显示相机设置。我能够通过命令行参数来控制相机模拟。首先,我让模拟器使用
-webcam-list
列出可能的值(它们不一定与系统的编号匹配)。然后我使用-camera-back webcam1
选择适当的视频设备。设备是现实世界的相机还是由 OBS 或 ffmpeg 提供的虚拟相机(例如 v4l2loopback)(例如 ffmpeg -hide_banner -loop 1 -r 10 -i image.png -filter: v format=yuv420p -f v4l2 /dev/video1) 由您决定。旁注
-help-camera-front
还提到了视频播放功能,但我无法使其工作。My emulator's menu also does not show the camera setting. I was able to gain control over the camera emulation via command-line arguments. First, I had the emulator list the possible values with
-webcam-list
(they do not necessarily match the system's numbering). Then I chose the appropriate video device with-camera-back webcam1
. Whether the device is a real world camera or a virtual camera (e.g.v4l2loopback
) fed by OBS or ffmpeg (e.g.ffmpeg -hide_banner -loop 1 -r 10 -i image.png -filter:v format=yuv420p -f v4l2 /dev/video1
) is up to you.Side-note
-help-camera-front
also mentions a video playback feature, but I could not make it work.