Xamarin Android Player:相机错误无法连接到相机 [英] Xamarin Android Player : Camera error Cant connect to Camera

查看:98
本文介绍了Xamarin Android Player:相机错误无法连接到相机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码在xamarin android应用中使用摄像头功能。

I am trying to use the camera capability in my xamarin android app using the below code.

Intent intent = new Intent(MediaStore.ActionImageCapture);
StartActivityForResult(intent, 0);

我已在Android Manifest中启用了摄像头,并遵循了教程

I have enabled camera in the Android Manifest and followed all that is mentioned in this tutorial.

但是在运行代码时出现此错误
照相机错误:无法连接到照相机。

However on running the code I get this error Camera Error : Cant connect to the Camera.

在模拟器中打开标准照相机应用程序时,我也遇到相同的错误

Also I get the same error when opening the standard camera app in the emulator

我尝试使用此链接&变种,但没有运气

I tried out enabling camera using this link & variations of it, but no luck

最后我在www.xamarin.com/android-player上注意到了这一点,

Finally I noticed this on www.xamarin.com/android-player,

使用计算机的网络摄像头在设备上模拟后置和前置摄像头。(即将推出)

"Use your computer’s webcam to simulate a back and front-facing camera on your device. (Coming soon)"

所以我的问题是xamarin android player是否支持使用相机,如果是,我该如何解决此问题以查看模拟的相机(如果不是我的PC网络摄像头)?

So my question is does xamarin android player support using camera, if yes how do I fix this issue to see emulated camera if not my pc webcam ?

AVD-android 4.4.2-API 19

AVD - android 4.4.2 - API 19

推荐答案

当我遵循同一教程时,我使用Xamarin并面临相同的问题。

I use Xamarin and just faced the same problem, when I was following this same tutorial.

我通过转到工具> Google Emulator Manager对其进行了修复,然后选择了我正在仿真的设备,然后单击编辑...。

I fixed it by going to Tools > Google Emulator Manager, then selected the device I was emulating and then clicked "Edit...".

在新窗口中,编辑Android虚拟设备(AVD),转到底部的硬件部分,并将配置摄像头朝前选项更改为模拟。

In the new window Edit Android Virtual Device (AVD) I went to hardware section at the bottom and changed 'Configures Camera facing front' option to "Emulated".

它对我有用,所以我认为我应该在这里发帖,以防万一。

It worked for me so I thought I should post here in case that helps.

这篇关于Xamarin Android Player:相机错误无法连接到相机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆