Chinaunix首页 | 论坛 | 博客
  • 博客访问: 926601
  • 博文数量: 146
  • 博客积分: 3321
  • 博客等级: 中校
  • 技术积分: 1523
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-29 10:32
文章分类

全部博文(146)

文章存档

2014年(2)

2013年(5)

2012年(4)

2011年(6)

2010年(30)

2009年(75)

2008年(24)

分类:

2009-02-28 22:06:12

如何在android模拟器中创建sdcard
sdcard其实就是模拟器的一个存储器。
 

1. 创建SD文件

命令行方式: mksdcard -l sdcard 200M d:/android/mysdcard/sdcard.img  这样就在d:/android/mysdcard/sdcard.img 创建了一个名为sdcard的200MSD卡镜像文件 注意这里sdcard.img必须有img后缀,我之前就是由于没有加这个后缀而导致无法向创建的镜像文件导入资料

mksdcard参数如下:

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

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

这里size用来指定镜像文件的大小 

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

命令行方式:emulator -sdcard d:/android/mysdcard/sdcard.img

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

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

可以用mtools来做管理,也可以用android SDK带的命令:
adb push local_file sdcard/remote_file

local_file表示要传输的文件绝对路径,或与Tools目录的相对路径

sdcard 和sdcard的镜像文件的联系:sdcard是手机的存储介质,但是,模拟器中只有一个sdcard的壳子而没有真正的sdcard也就是说这个模拟器中的sdcard一般是不能存储文件的,所以我们就要在硬盘上模拟出一块区域作为模拟器的存储介质即sdcard.img,也就是我们导入的文件都存储于这个镜像文件中。这个sdcard.img只有android模拟器能够认识,所以他不是我们想像中的一个文件夹,我们不能直接打开它,要想获取它里边存储的内容只能通过模拟器中的sdcard这个壳子。

 

阅读(1780) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~