我在 Windows 上的 WSL Ubuntu 22.04.3 LTS 上运行模拟器时遇到错误
当我已经在 ubuntu 服务器中安装了 kvm 并尝试创建 avd 设备时,出现了错误。
lsmod | grep kvm
不发射任何东西。
而
modprobe kvm_intel
和modprobe kvm_amd
成功运行但没有结果。
$ lsmod | grep kvm
$ dmesg | grep kvm
[ 1.396487] kvm: no hardware support
[ 1.396493] kvm: no hardware support
$ modprobe kvm_intel
$ modprobe kvm_amd
创建 AVD 设备
$ avdmanager create avd -n device \
--device pixel -k "system-images;android-33;google_apis_playstore;x86_64
运行 AVD 设备
$ emulator @device
INFO | Storing crashdata in: /tmp/android-noid/emu-crash-34.2.15.db, detection is enabled for process: 9068
INFO | Android emulator version 34.2.15.0 (build_id 11906825) (CL:N/A)
INFO | Found systemPath /home/noid/.android_sdk/system-images/android-33/google_apis_playstore/x86_64/
INFO | Storing crashdata in: /tmp/android-noid/emu-crash-34.2.15.db, detection is enabled for process: 9068
INFO | Duplicate loglines will be removed, if you wish to see each individual line launch with the -log-nofilter flag.
INFO | Increasing RAM size to 2048MB
ERROR | x86_64 emulation currently requires hardware acceleration!
CPU acceleration status: Could not open /dev/kvm : No such device
More info on configuring VM acceleration on Linux:
https://developer.android.com/studio/run/emulator-acceleration#vm-linux
General information on acceleration: https://developer.android.com/studio/run/emulator-acceleration.
WSL 不支持 KVM 所需的嵌套虚拟化。您可以使用完整的 VM 或双启动来支持 KVM。