Android VMware 虚拟机上的 Studio 运行:未安装 KVM

Android Studio running on VMware virtual machine: KVM is not installed

我 运行正在 Android Studio Ubuntu VMWare 虚拟机上。问题是,当我尝试 运行 使用 AVD 模拟器的应用程序时,我在控制台中收到以下错误:

/home/verite/Android/Sdk/tools/emulator -avd Nexus_5_API_22_x86 -netspeed full -netdelay none
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: KVM is not installed on this machine (/dev/kvm is missing).

我尝试通过这样做来解决问题:

sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
sudo adduser `id -un` libvirtd
sudo adduser `id -un` kvm

并重新启动,但它不起作用。当我发出命令时:

sudo kvm-ok

我明白了

INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used

有人可以告诉我如何解决这个问题吗?

谢谢

官方Android开发者网站Using the Emulator section中发现的坏消息:

Not Inside a VM - You cannot run a VM-accelerated emulator inside another virtual machine, such as a VirtualBox or VMWare-hosted virtual machine. You must run the emulator directly on your system hardware.

所以我最好的选择似乎是为 运行 应用程序寻找与 Android Studio 兼容的真实设备。

我遇到了同样的问题。我搜索并找到了现在适用于我的解决方案:

在 VMware 中:

  1. 打开虚拟机设置。
  2. 转到处理器。
  3. 选中虚拟化 Intel VT-x/EPT 或 AMD-RVI 选项。
  4. 单击确定,运行 虚拟机,它应该可以正常工作。

希望对你有用。

这 link HW virtualization in VMware (KVM - Android Studio) 帮助我找到了解决方案。

您让 vCenter 和 vSphere Web 客户端使用它来编辑 VM 配置右键单击 Your_Windows_GuestOs > 编辑设置 > CPU > 选中“向来宾公开硬件辅助虚拟化”框 OS .

在云虚拟机(AWS windows 服务器)上安装 Android

由于我的机器在使用 Android Studio 时速度很慢,所以我在 AWS 上的 windows 服务器上创建了一个虚拟机,具有最好的处理器和 RAM 配置,这为我提供了无缝的编程和执行体验。但是要使用模拟器,我会遇到下面列出的错误。

Error:
Unable to install Intel HAXM
HAXM doesn't support nested virtual machines.
Unfortunately, the Android Emulator can't support virtual machine acceleration from within a virtual machine.
Here are some of your options:
 1) Use a physical device for testing
 2) Start the emulator on a non-virtualized operating system
 3) Use an Android Virtual Device based on an ARM system image (This is 10x slower than hardware accelerated virtualization)

由于我们无法将我们的设备连接到云计算机,因此选项 #3 是最好的方法。

安装 Android 工作室后,

Go to Tools -> Android -> AVD Manager

Click "Create Virtual Device"

Select which device you want to use from the list (i.e Nexus 5) and click "Next".

Here you're given a list of android release versions. Look at the ABI column. 

Choose "Armeabi-v7a" for whichever API Level you want.

Hit "Next" and modify name/size, click "Finish" when done.

if 'Next' doesn't work, download the desired image and continue

我在 VMWare 来宾中有 android 个模拟器 运行ning。它使用 Windows 而不是 Linux,但原则适用。如前所述,最重要的项目是确保检查虚拟化的 VMWare 处理器设置。

这是我的具体情况: 我为主机和来宾 运行ning Win10。 我有 Android 工作室 android 仿真器 运行 在单个 VMWare 来宾中 运行 使用 VMWare 的播放器软件。

Here are the versions:
Windows 10 64 bit both host and guest.
Windows 10 guest Ram 6 Gig
Android studio 3.3.2
AVD Emulator
VMWare Player 12, 12.5.1 build-4542065
VMware Number of Processors: 1
VMWare Setting for Processors: Virtualize Intel VT checked.

我在 运行 在云 VM 中使用 AVD 时遇到了完全相同的错误,添加许可证解决了它。

因此,VMWare 任何云提供商都不会为您提供创建嵌套虚拟机的能力。它在默认情况下被阻止,因此 Android 工作室可以工作,但您将无法 运行 AVD,这没什么用。

要允许这样做,您将在创建 VM 时添加以下许可证-

https://compute.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx

Note: This works only for GCP, you need to add different licenses for VMWare

这只是您要执行的操作和涉及的主要步骤的简短说明,但是,我强烈建议您阅读我的 this 博客,其中提供了执行此操作的分步指南。

我还敦促您查看我的 回答,我在其中对 GCP 进行了更详细的解释。