Android emulator Android模拟器在macOS Big Sur 11.3+;
我已经将mac OS升级到Big Sur,但没有一个模拟器可以工作。似乎所有Android模拟器在Mac OS Big Sur Beta上都失败了。我删除了旧的模拟器,创建了具有不同硬件/软件的新模拟器,但没有成功。介绍了android emulator中的以下问题Android emulator Android模拟器在macOS Big Sur 11.3+;,android-emulator,macos-big-sur,Android Emulator,Macos Big Sur,我已经将mac OS升级到Big Sur,但没有一个模拟器可以工作。似乎所有Android模拟器在Mac OS Big Sur Beta上都失败了。我删除了旧的模拟器,创建了具有不同硬件/软件的新模拟器,但没有成功。介绍了android emulator中的以下问题 FFFFFFFF B69B4DBB:未处理的出口1d 模拟器引擎失败 adb设备脱机 有人有解决办法吗 编辑2021年4月27日 ~/Library/Android/sdk/emulator/emulator -gpu host
~/Library/Android/sdk/emulator/emulator -gpu host -read-only -feature HVF -avd Pixel_4_API_29
emulator: Android emulator version 30.5.5.0 (build_id 7285888) (CL:N/A)
handleCpuAcceleration: feature check for hvf
cannot add library /Users/dunatv/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib: failed
added library /Users/dunatv/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
cannot add library /Users/dunatv/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libMoltenVK.dylib: failed
HVF error: HV_ERROR
qemu-system-x86_64: failed to initialize HVF: Invalid argument
HAX is working and emulator runs in fast virt mode.
qemu-system-x86_64: Back to HAX accelerator
added library /Users/dunatv/Library/Android/sdk/emulator/lib64/vulkan/libMoltenVK.dylib
emulator: INFO: GrpcServices.cpp:301: Started GRPC server at 127.0.0.1:8554, security: Local
我的解决方案是从Android studio AVD中擦除数据,然后使用./emulator@Pixel_3a_API_29命令反复启动它,直到它成功启动。在尝试了许多关于SO的答案/注释后,发现此解决方法可行且可重复:
emulator
CLI启动AVD…未处理的退出1d
⌃ + c
或按emulator侧栏上的x
注意:从Android Studio/AVD管理器GUI启动相同的AVD仍会遇到此异常,因此在需要时-如步骤2所示启动模拟器。更新,10-1-2020 Android Emulator团队推出了30.1.5版本,该版本在stable中修复了这个问题。开发版本30.2.0不包含此修复程序。据谷歌的研究人员称,它应该“很快”就能上市 另一个注意事项是,如果您的模拟器性能不佳,您可能希望尝试使用主机的GPU进行渲染。这可以通过在终端中运行以下命令来实现,其中-avd是仿真器设备的名称,空格变成下划线
~/Library/Android/sdk/emulator/emulator -gpu host -feature HVF -avd pixel_3a_api_29
旧信息,出于教育价值而保存:
是对解决Big Sur此问题的提交的引用。这看起来应该在emulator 30.1.5(见日志)中发布,它应该在下一个canary版本中发布
如果你等不及了,你应该可以从那个分支上建起。从回购协议自述文件中大量提取的轻度测试指南:
# Get the google repo tool - you can skip if you already have it
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo && chmod +x /usr/local/bin/repo
# Get the code, will take some time. Probably best to go get a coffee here or run on a server if you have poor internet
mkdir -p $HOME/emu-master-dev && cd $HOME/emu-master-dev
repo init -u https://android.googlesource.com/platform/manifest -b emu-master-dev
repo sync -j8
# Get XCode 10.1 - required
https://download.developer.apple.com/Developer_Tools/Xcode_10.1/Xcode_10.1.xip
sudo xcodebuild -license accept &&
sudo xcode-select --install
# Get MacOS 10.13 SDK which is required
export XCODE_PATH=$(xcode-select -print-path 2>/dev/null)
git clone https://github.com/phracker/MacOSX-SDKs
cp -r MacOSX-SDKs/MacOSX10.13.sdk/ "$XCODE_PATH/Platforms/MacOSX.platform/Developer/SDKs"
# Build the emulator, which will be another coffee break...
cd external/qemu && android/rebuild.sh
# run it :)
./objs/emulator -list-avds
在上次BigSur测试版更新(11.0测试版(20A5395g))之后,Android Studio一直关闭。如果我打开任何子窗口,UI都没有响应
永远不要再像这样运行模拟器了:
~/Library/Android/sdk/emulator/emulator -wipe-data @Pixel_3a_API_30
为我修复了它。似乎可以使用emulator
30.2.6
(目前最新的beta频道)
尽管锁文件存在问题,阻止了emu的启动
以下是让一切恢复正常的原因:
~/.android/avd/*.avd/
文件夹并删除硬件qemu.ini.lock
文件(如果存在)更新:这应该由稳定频道中的Android emulator版本30.5.6修复 但是,如果您在更新到最新版本的Android Emulator后遇到问题,您可以通过从SDK管理器中删除并重新添加Android Emulator来解决此问题。 工具>SDK管理器>SDK工具
取消选中Android Emulator并点击apply。
检查Android Emulator并点击apply
原始答复: 这对我有用 本质上,创建一个名为
authorights.XML
的XML文件,该文件包含以下内容:
com.apple.security.hypervisor
将XML文件复制到~/Library/Android/sdk/emulator/qemu/darwin-x86_64
然后在终端中运行以下命令:
codesign -s - --entitlements entitlements.xml --force qemu-system-aarch64
codesign -s - --entitlements entitlements.xml --force qemu-system-aarch64-headless
codesign -s - --entitlements entitlements.xml --force qemu-system-armel
codesign -s - --entitlements entitlements.xml --force qemu-system-armel-headless
codesign -s - --entitlements entitlements.xml --force qemu-system-i386
codesign -s - --entitlements entitlements.xml --force qemu-system-i386-headless
codesign -s - --entitlements entitlements.xml --force qemu-system-x86_64
codesign -s - --entitlements entitlements.xml --force qemu-system-x86_64-headless
解决问题的步骤: 1.打开终端,进入目录
/Users//Library/Android/sdk/emulator/qemu/darwin-x86_64/
2.使用touch
或cat
命令创建名为authorities.xml
的xml文件
3.将此内容添加到授权.xml
文件:
com.apple.security.hypervisor
4.然后简单地在qemu-system-x86_64上签名:
codesign-s----entications-authorities.xml--force qemu-system-x86_64
5.现在只需重新启动Android Studio,Android仿真器就会再次工作 正如@Demirezen提到的,目前这是一个代码签名问题。
您可以自己进行代码签名,也可以使用emulator 30.6.4解决此问题。使缓存无效/重新启动并重新创建映像,似乎有些幕后配置无法向前兼容
/Users//Library/Android/sdk/emulator/qemu/
64
,则:arm64-v8a
+API LEVEL=S创建虚拟设备在这些步骤之后,emulator应该被打开。我也遇到了同样的问题,只要将您的android studio和所有sdk工具更新到最新版本,一切都会正常工作。添加适当的
android\u AVD\u HOME
会有所帮助。
您可以将
导出ANDROID\u AVD\u HOME=$HOME/.ANDROID/AVD
添加到~/.bash\u profile
还有另一张票证:。我相信最终会有一个和另一个融合在一起。我是同一条船上的。我几乎所有的测试时间都花在尝试引导到模拟器上。我认为这个问题是相关的:它对我不起作用,但也许可以帮助其他人,因为有一些解决方案对其他用户有效。也许它也能帮助这里的人。我在那里也分享了这个问题,原因与G团队在emulator sid上解决了这个问题相同
codesign -s - --entitlements entitlements.xml --force qemu-system-aarch64
codesign -s - --entitlements entitlements.xml --force qemu-system-aarch64-headless
codesign -s - --entitlements entitlements.xml --force qemu-system-armel
codesign -s - --entitlements entitlements.xml --force qemu-system-armel-headless
codesign -s - --entitlements entitlements.xml --force qemu-system-i386
codesign -s - --entitlements entitlements.xml --force qemu-system-i386-headless
codesign -s - --entitlements entitlements.xml --force qemu-system-x86_64
codesign -s - --entitlements entitlements.xml --force qemu-system-x86_64-headless