You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何从编译后的AOSP创建AVD并在Intel Mac运行

在Intel Mac上运行编译好的AOSP镜像(最小文件集方案)

一、需要复制的最小文件集

从Azure Linux机器的out/target/product/generic_x86_64/目录下,仅需复制以下文件:

  • 核心镜像文件:system.img、userdata.img、vendor.img、boot.img
  • 模拟器内核:kernel-ranchu(x86_64架构模拟器专用)

注:部分旧版AOSP可能需要额外复制ramdisk.img,如果启动时报错可以补充该文件。

二、具体操作步骤

1. 在Linux编译机打包必要文件

进入AOSP根目录的产物路径,打包目标文件:

cd out/target/product/generic_x86_64
tar -czf aosp-emulator-files.tar.gz system.img userdata.img vendor.img boot.img kernel-ranchu

将生成的aosp-emulator-files.tar.gz传输到本地Intel Mac(可通过scp、Azure存储下载等方式)。

2. 本地Mac准备运行环境

确保已安装Android SDK,且emulator命令可直接调用(或使用SDK完整路径,如~/Library/Android/sdk/emulator/emulator)。若未创建过AVD,先创建一个空的x86_64架构AVD:

avdmanager create avd -n dummy_avd -k "system-images;android-XX;google_apis;x86_64"

将android-XX替换为你的AOSP对应的Android版本号(如android-34)。

3. 启动自定义AOSP镜像

解压压缩包到本地目录(如~/aosp-imgs),执行以下命令启动模拟器:

emulator -avd dummy_avd -kernel ~/aosp-imgs/kernel-ranchu -system ~/aosp-imgs/system.img -userdata ~/aosp-imgs/userdata.img -vendor ~/aosp-imgs/vendor.img -bootimage ~/aosp-imgs/boot.img -wipe-data -no-snapshot
  • -wipe-data:确保以干净的用户数据启动
  • -no-snapshot:禁用快照,避免旧状态干扰

三、关于emu_imgs_zip命令的说明

该目标在新版AOSP(Android 13及以后分支)已被移除,无需再尝试使用。直接通过上述手动加载镜像的方式,就能在本地Mac模拟器运行自定义编译的AOSP。

内容的提问来源于stack exchange,提问作者Kanav Gupta

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 14:47:36