android 模拟器sd卡使用方法

Android模拟器能够让我们使用fat32格式的磁盘镜像作为SD卡的模拟: 
以下所有操作均在windows环境

首先,运行cmd,进入命令行界面(需要预先将你放置android sdk所在目录下的tools设置到环境变量path中)

以下除eclipse方式,其他均在命令行运行

1. 创建SD文件

命令行方式: mksdcard -l sdcard 512M d:/android/mysdcard/sdcard.img  这样就在d:/android/mysdcard/sdcard.img 创建了一个512M的SD卡镜像文件

mksdcard参数如下:

mksdcard: create a blank FAT32 image to be used with the Android emulator
usage: mksdcard [-l label] <size> <file>

  if <size> is a simple integer, it specifies a size in bytes
  if <size> is an integer followed by 'K', it specifies a size in KiB
  if <size> is an integer followed by 'M', it specifies a size in MiB

 

2.在模拟器中加载刚创建的SD文件

eclipse方式:(前提是安装了google android 插件), 选择菜单“Run” -> "Run Configurations..." ,进入弹出页面,选择"Targets"标签,在最下面一行"Aditional Emulator Command Line Options"下面增加启动参数 -sdcardd:/android/mysdcard/sdcard.img

 

3.向SD卡传输文件(管理SD卡上的内容)

eclipse方式:

通过DDMS标签中的File Explorer文件浏览器在传输如图:

选择mnt--sdcard路径后,点击

图标,选择你要上传的文件,比如:1.mp3,那么在项目中,引用的路径为:/sdcard/1.mp3.

如何向模拟器的SD卡上拷贝文件?

在模拟器启动完毕后,在windows下cmd进入platform-tools文件夹路径,我的是:D:\android-sdk\platform-tools

之后使用adb push命令,及adb push d:\dd.xls /sdcard/dd.xls

原文地址:https://www.cnblogs.com/jiuzhexingfu/p/2222300.html