(重新)在 android 模拟器上安装 SD 卡

(re)mounting the SD card on android emulator((重新)在 android 模拟器上安装 SD 卡)

本文介绍了(重新)在 android 模拟器上安装 SD 卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在模拟器上,我可以从设置中卸载 SD 卡.

On the emulator, I can unmount the SD card from the Settings.

然后我可以将它安装到我的操作系统上,然后正常卸载它.

I can then mount it on my OS, then unmount it normally.

我无法弄清楚如何在模拟器上重新安装它(无需重新启动它).

I haven't been able to figure out how to re-mount it then on the emulator (without rebooting it).

提示:

  • adb 命令 remount 无关:它是关于 /system
  • emulator 命令无关:它只是关于启动模拟器
  • 在两个地方安装 SD 卡当然会搞砸一切(我试过)
  • the adb command remount is unrelated: it's about /system
  • the emulator command is unrelated: it's only about starting the emulator
  • mounting the SD card in two places of course messing everything up (I tried)

更多:

  • mount 输出以下内容:

/dev/block//vold/179:0/sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0

在卸载外壳后尝试再次从外壳安装,使用与上述相同的选项,会出现段错误

trying to mount again from the shell after unmounting it, using the same options as above, gives a segfault

推荐答案

开发人员指南建议这是不可能的:

SD 卡模拟

您可以创建磁盘映像,然后在启动时将其加载到模拟器中,以模拟用户 SD 的存在设备中的卡.为此,您可以使用android工具创建一个带有新 AVD 的新 SD 卡映像,或您可以使用 mksdcard 实用程序包含在 SDK 中.

You can create a disk image and then load it to the emulator at startup, to simulate the presence of a user's SD card in the device. To do this, you can use the android tool to create a new SD card image with a new AVD, or you can use the mksdcard utility included in the SDK.

以下部分描述了如何创建 SD 卡磁盘映像,如何将文件复制到它,以及如何加载它启动时在模拟器中.

The sections below describe how to create an SD card disk image, how to copy files to it, and how to load it in the emulator at startup.

请注意,您只能加载磁盘映像在模拟器启动时.同样,你无法移除模拟 SD 卡来自正在运行的模拟器. 但是,您可以浏览、发送文件到和从模拟 SD 复制/删除文件使用 adb 或模拟器卡.

Note that you can only load disk image at emulator startup. Similarly, you can not remove a simulated SD card from a running emulator. However, you can browse, send files to, and copy/remove files from a simulated SD card either with adb or the emulator.

模拟器支持模拟 SDHC卡,因此您可以创建 SD 卡任何大小的图像,最大 128 GB.

The emulator supports emulated SDHC cards, so you can create an SD card image of any size up to 128 gigabytes.

虽然 Android 会卸载 SD 卡,但模拟器进程会保持备份文件处于打开状态.

While Android will unmount the SD card, the emulator process keeps the backing file open.

$ ls -go /proc/`pidof emulator`/fd | grep sdcard.img
lrwx------ 1 64 2010-05-13 01:50 10 -> /home/x/.android/avd/WithSD.avd/sdcard.img

更熟悉 QEMU 的人可能能够提供进一步的见解,但如果我是你,我会尝试使用 NFS 来解决这个问题.

Someone more familiar with QEMU may be able to provide further insight but, if I were you, I would just try to use NFS to solve this problem.

这篇关于(重新)在 android 模拟器上安装 SD 卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:(重新)在 android 模拟器上安装 SD 卡

基础教程推荐