简体   繁体   English

Android 模拟器不能与 Xamarin / Visual Studio Mac 一起使用

[英]Android Emulator not working with Xamarin / Visual Studio Mac

Hi i'm really struggling to get the Android emulator running on my Mac.嗨,我真的很难让 Android 模拟器在我的 Mac 上运行。 What are the steps I need to take to get this working?我需要采取哪些步骤才能使其正常工作?

I've got Visual Studio 2019 on MacOS Catalina我在 MacOS Catalina 上安装了 Visual Studio 2019

This is on a new blank Xamarin Forms project这是一个新的空白 Xamarin Forms 项目

I've tried to go Tools > Device Manager > New Device.我试过 go 工具 > 设备管理器 > 新设备。 Pixel 3 XL, x86_64, Q 10.像素 3 XL,x86_64,Q 10。

I keep getting this message:我不断收到此消息:

Android emulator component is incomplete therefore the device Pixel 3 XL Q 10.0 - API 29 could not be created. Android 仿真器组件不完整,因此无法创建设备 Pixel 3 XL Q 10.0 - API 29。 Do you want us to reinstall the Android Emulator?您希望我们重新安装 Android 仿真器吗?

I've clicked the button to reinstall the android emulator but it doesnt work.我点击了重新安装 android 仿真器的按钮,但它不起作用。

Also tried with OS 8.1 and setting processor as x86 - all the combinations give a similar error messages还尝试使用 OS 8.1 并将处理器设置为 x86 - 所有组合都会给出类似的错误消息

When i go to Tools > SDK Manager, the following are ticked:当我 go 到 Tools > SDK Manager 时,勾选以下:

Android 10.0 - Q Android 10.0 - Q

  • Android SDK Platform 29 Android SDK 平台 29
  • Intel x86 Atom_64 System Image英特尔 x86 Atom_64 系统映像
  • Google APIs Intel x86 Atom_64 System Image Google API 英特尔 x86 Atom_64 系统映像
  • Google APIs Intel x86 Atom System Image Google API 英特尔 x86 Atom 系统映像

Similar for 9.0, 8.1, 7.1, 7.0, 6.0 9.0、8.1、7.1、7.0、6.0 类似

Version details - Version is 8.6.2 (build 6)版本详细信息- 版本为 8.6.2(内部版本 6)

  • Android SDK Manager Android SDK 经理

    • Version: 16.6.0.50版本:16.6.0.50
    • Hash: 5901879 Hash:5901879
    • Branch: remotes/origin/d16-6分支:遥控器/origin/d16-6
    • Build date: 2020-04-30 04:01:22 UTC构建日期:2020-04-30 04:01:22 UTC
  • Android Device Manager Android 设备管理器

    • Version: 16.6.0.95版本:16.6.0.95
    • Hash: 45d17b5 Hash:45d17b5
    • Branch: remotes/origin/d16-6分支:遥控器/origin/d16-6
    • Build date: 2020-04-30 04:01:42 UTC构建日期:2020-04-30 04:01:42 UTC
  • Xamarin.Android Xamarin.Android

    • Version: 10.3.1.4 (Visual Studio Community)版本:10.3.1.4(Visual Studio 社区)
    • Commit: xamarin-android/d16-6/3a10de9提交:xamarin-android/d16-6/3a10de9
  • Android SDK: /Users/user/Library/Developer/Xamarin/android-sdk-macosx Android SDK:/Users/user/Library/Developer/Xamarin/android-sdk-macosx

  • Supported Android versions:支持的 Android 版本:
    • 6.0 (API level 23) 6.0(API 级别 23)
    • 7.1 (API level 25) 7.1(API 级别 25)
    • 8.0 (API level 26) 8.0(API 级别 26)
    • 8.1 (API level 27) 8.1(API 级别 27)

I ended up downloading Android Studio, then running the installers from there and then finally went back to VS Mac and installed an emulator device - that seemed to work.我最终下载了 Android Studio,然后从那里运行安装程序,最后回到 VS Mac 并安装了一个仿真器设备——这似乎工作。

I am able to solve the issue by creating an XML file named entitlements.xml with the following content:我可以通过创建一个名为 entitlements.xml 的 XML 文件来解决这个问题,其中包含以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.hypervisor</key>
    <true/>
</dict>
</plist>

Then run the following command然后运行以下命令

codesign -s - --entitlements entitlements.xml --force /Users/macbookpro/Library/Developer/Xamarin/android-sdk-macosx/emulator/qemu/darwin-x86_64/qemu-system-x86_64

to identify your Android SDK installed folder use Visual Studio> Tools > SDK Manager then check the Android SDK path to identify your Android SDK installed folder use Visual Studio> Tools > SDK Manager then check the Android SDK path

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM