一、为什么要下载模拟器?
选择软件自带的模拟器,只能模拟前端页面,对于打开图库选择图片无法实现。
二、在开发软件点击“设备管理器” -> “新建模拟器” 下载一个镜像文件
三、运行下载的模拟器镜像文件。
Windows 11 家庭版需要下载 hyper-v 虚拟机
下载方法:
1、新建文本文档,粘贴下方代码:
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
2、将文本另存为 hyper-v.bat
3、以管理员身份运行 hyper-v.bat
4、重启,在鸿蒙开发工具运行镜像
四、调试程序 在镜像模拟器上点击