[英]Android emulator does not mount external SD card
I'm trying to run freshly built Android image on emulator (generic aosp_x86-eng
target built from current master
using Google sources). 我正在尝试在模拟器上运行新构建的Android映像(从使用Google来源的当前master
构建的通用aosp_x86-eng
目标)。 The emulator seems to be working fine, except it does not mount external SD card when run with -sdcard
option. 该仿真器似乎运行良好,但使用-sdcard
选项运行时不会安装外部SD卡。 Emulator version is the one that comes from the git. 模拟器版本是来自git的版本。 Everything is executed on a headless server. 一切都在无头服务器上执行。
My complete list of steps: 我的完整步骤清单:
repo init -u https://android.googlesource.com/platform/manifest
repo sync
. build/envsetup.sh
lunch aosp_x86-eng
make -j16
mksdcard 1G sd.img
emulator -no-window -no-skin -no-audio -sdcard sd.img &
adb shell mount | grep vfat
The virtual device appears to be correctly forwarded, as seen by the output of adb shell blkid
: 如adb shell blkid
的输出所示,虚拟设备似乎已正确转发:
/dev/block/vda1: LABEL="system" UUID="da594c53-9beb-f85c-85c5-cedf76546f7a" TYPE="ext4"
/dev/block/vdb: LABEL="cache" UUID="f73de97f-7017-ca5e-9b47-ca9c8f633e83" TYPE="ext4"
/dev/block/vde1: LABEL="vendor" UUID="6d16bab1-58d9-3c5d-8f14-f608f924affd" TYPE="ext4"
/dev/block/vdf: LABEL="SDCARD" UUID="1CEA-0B06" TYPE="vfat"
However, it is not mounted by vold
. 但是,它不是由vold
安装的。 What could be the problem? 可能是什么问题呢?
I also get the same result when I run emulator using Android 8 image downloaded via SDK manager. 当我使用通过SDK管理器下载的Android 8图像运行模拟器时,也会得到相同的结果。 With Android 7, SD card works OK. 在Android 7上,SD卡可以正常运行。
EDIT: 编辑:
Solved the issue for emulator that comes with aosp_x86-eng build (see my own answer). 解决了aosp_x86-eng构建随附的仿真器的问题(请参阅我自己的答案)。 On the emulator from Android SDK, the cause is probably different. 在Android SDK的仿真器上,原因可能不同。
Turns out, in my case headless mode was the culprit. 事实证明,在我的情况下,无头模式才是罪魁祸首。 When I run emulator with -no-skin -no-window
options, SD card is not mounted. 当我使用-no-skin -no-window
选项运行模拟器时,未安装SD卡。 If I remove these options (and enable X11 forwarding, since I work on a headless server), everything works correctly. 如果我删除了这些选项(由于我在无头服务器上工作,则启用了X11转发),则一切正常。
I still want to know why I can't use SD card in headless mode, but at least I was able to solve the problem for the required task. 我仍然想知道为什么我不能在无头模式下使用SD卡,但是至少我能够解决所需任务的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.