【问题标题】:Visual Studio C++ and Android Emulator?Visual Studio C++ 和 Android 模拟器?
【发布时间】:2016-02-08 20:06:19
【问题描述】:

我想为 android 制作游戏,但我不想用 java 编程。

Visual Studio 支持 C++ 中的 Android 应用程序,当我启动/调试应用程序时,它会说:

Severity    Code    Description Project File    Line
Error       Error installing the package. The device '' is invalid or not running.  Please switch to another device, or use the Android Virtual Device (AVD) Manager to start a compatible emulator, or connect a compatible Android device.    Android1_test.Packaging     0

我已经安装了 xamarin 模拟器,但我无法调试我的项目,而且我没有安装“Microsoft Visual Studio Emulator for Android”,当我尝试安装它时,我收到错误“安装程序被阻止”和这个:

This computer does not support the Visual Studio Emulator for Android, which requires a 64-bit Windows 8/8.1/10 Pro/Enterprise edition or Window Server 2012 or above and a computer that supports Hyper-V. For more information, see System Requirements for Visual Studio Emulator for Android (https://msdn.microsoft.com/en-us/library/mt228280.aspx).

我需要安装“Hyper-V server 2012...”之类的吗?

编辑:我有 Windows 10 Home,它不支持 Hyper-V。谢谢微软(Windows 10 Pro ($129.99) 支持 Hyper-V)

【问题讨论】:

  • 仔细看:“需要 64 位 Windows 8/8.1/10 Pro/Enterprise 版或 Window Server 2012 或更高版本”、“以及支持 Hyper-V 的计算机”
  • 您使用的是什么版本的 Windows?错误消息特别提到 64 位Windows 8 Pro/Enterprise 或更新版本。
  • 我有 Windows 10 Home 64 位,你能给我 Hyper-V 的链接吗?
  • 点击错误消息中的链接。它列出了要求。

标签: c++ visual-studio android-emulator


【解决方案1】:

具有 API 级别 9 的 Android 发布了一种创建真正 C++ 应用程序的方法。这种方法称为 NativeActivity,许多流行的游戏引擎,如 Unreal 和其他引擎都使用这种机制。 Visual Studio 附带 Visual Studio Android Emulator,您可以下载它以获得 OOTB 体验。

希望这会有所帮助,如果您对您的体验仍有其他疑问或问题,请随时通过 aasthan@microsoft.com 联系。

【讨论】:

    【解决方案2】:

    适用于 Android 的 Visual Studio Emulator 非常好用,但正如您所发现的,它仅在运行支持 Hyper-V 的 Windows 版本的机器上可用,不包括 Home 版本。您需要专业版才能获得该功能。幸运的是,这不是使用 Visual Studio 为 Android 开发应用程序的唯一选择。 Android SDK 带有一个基本的模拟器,可以在 Windows 7、8.1 或 10 Home 版本上运行,尽管它的性能不高(阅读:它使蜗牛看起来很快)。英特尔有一个更容易接受的解决方案,称为 HAXM(硬件加速执行管理器),您可以尝试一下。 HAXM 是 Hyper-V 的替代方案,专为支持 Android 开发的快速仿真而设计(换句话说,您不能同时运行 HAXM 和 Hyper-V)。要使用它,您需要有一个支持 VT-x 和 XD 的 64 位 Intel 处理器,这些指令用于启用 VM 支持。 Intel provides installation instructions here.

    另一种选择是使用 USB 数据线连接 Android 设备。大多数设备允许您在设置中启用开发人员选项。这里有一些common instructions on enabling Developer Options,但在某些情况下,您必须查找如何为您的特定设备执行此操作,因为它会有所不同。当您在启用 USB 连接的开发人员选项的情况下将 Android 设备连接到计算机时,该设备将显示在 Visual Studio 的部署目标下拉列表中。您可以直接向其部署代码并以与使用模拟器相同的方式对其进行远程调试。请确保将您的构建配置与您所针对的设备的体系结构相匹配。模拟器使用 x86 代码,而大多数(不是所有)Android 设备都有 ARM 处理器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-12
      • 1970-01-01
      • 2022-12-17
      • 2015-10-24
      • 2015-01-17
      • 1970-01-01
      • 2017-04-15
      • 1970-01-01
      相关资源
      最近更新 更多