`

sdcard in emulator

阅读更多
http://blog.jayway.com/2009/04/22/working-with-sd-cards-in-the-android-emulator/

Working with SD cards in the Android emulator

April 22nd, 2009 by Mårten Österberg — Android, Embedded
Mårten Österberg

Working with external storage in the Android emulator could be a little tricky and the documentation is not easy to find. I'll try to give a brief walk through of the steps needed to create a SD card image, mount the image in Linux, put content on it and use it in the emulator.

Creating a SD card image
In both the 1.1 and 1.5 version of the SDK there is a tool called mksdcard located in the SDK Install Dir/tools folder. Simply run

./mksdcard 128M my128MbCard

to create a 128Mb SD card with the name my128MbCard.

Mounting a SD card image in Linux
To be able to put content on to the card you can mount the card in Linux. It will then simply appear as a folder in the filesystem.
First make a directory in the /media folder:

sudo mkdir /media/mycard

Then mount the card as a loopback device:

sudo mount -o loop my128MbCard /media/mycard

Adding content to the card
With content we usually mean media content like images and videos. Images and videos are located in a folder called /dcim/Camera. You could of course add any content to the card. When you are done copying your files be sure to umount the card otherwise it will not be usable from the emulator.

sudo umount /media/mycard/

Using the card in the emulator
Google added something called Android Virtual Device (AVD) to the SDK 1.5. To create a new AVD using our newly created SDcard image run the following:

./android create avd --name myAVD --target 2 --sdcard my128MbCard

Target 2 means that we want to use the 1.5 API features in the device. Now we simply fire up the emulator and start using our content:

./emulator -avd myAVD
分享到:
评论

相关推荐

    Android模拟器参数 emulator启动设置

    29. **`-audio-in<backend>`** 和 **`-audio-out<backend>`** - **功能**:分别使用指定的输入和输出音频backend。 - **应用场景**:用于指定特定的音频输入输出设备。 30. **`-raw-keys`** - **功能**:禁用...

    Android代码-first_android_experience

    create an sdcard image to use with the emulator: mksdcard 2048M sdcard.img Then in your Eclipse preferences, go to Android > Launch, and add: -sdcard /sdcard.img to the Default Emulator Options field...

    Android使用SDK方法详解

    emulator -sdcard <sdcard镜像文件> ``` - **实际操作示例**: ```bash emulator -sdcard sdcard.img ``` 3. **将资源放入到SDCard里** - **命令格式**: ```bash adb push <source-file> /sdcard/ ``` -...

    手机模拟器手机模拟器手机模拟器

    2. **问题2:没有找到搜索路径**(如:`emulator: ERROR: no search paths found in this AVD's configuration`): - **原因**:通常是因为模拟器配置文件中的路径包含中文字符,导致解析错误。 - **解决方案**:...

    imx8qm_images.tar.gz

    Buildroot prepares a bootable "sdcard.img" image in the output/images/ directory, ready to be dumped on a SD card. Launch the following command as root: dd if=output/images/sdcard.img of=/dev/ *** ...

    学习 camera framework 总结

    emulator -sdcard <sdcard_image_file> ``` 通过 `adb logcat` 命令获取日志,检查 Camera Framework 的运行情况。 #### 三、Camera Framework 的实现 ##### 1. 实现 Camera Hardware Interface `...

    数据通信-成为Android数据流大师

    emulator -avd <avd_name> -sdcard ``` 2. 也可以通过修改AVD配置文件,将SD卡路径添加到其中。 **使用SD卡:** 1. **复制文件**:可以通过`adb push`命令将文件从主机复制到模拟器中的SD卡。 ```bash adb ...

    adb1.0.26包含fastboot.exe

    INSTALL_FAILED_MEDIA_UNAVAILABLE 安装位置不可用 一般为 sdcard,确认 sdcard 可用或安装到内置存储 INSTALL_FAILED_VERIFICATION_TIMEOUT 验证安装包超时 INSTALL_FAILED_VERIFICATION_FAILURE 验证安装包失败 ...

    【eoeAndroid特刊】第六期 数据通信-成为Android数据流大师

    emulator -avd my_avd -sdcard C:\Users\Username\Documents\my_sdcard.img ``` **2.2 装载SD卡** 创建完SD卡镜像文件后,需要将其装载到模拟器中。 **步骤:** 1. 在模拟器设置中选择要使用的AVD配置。 2. 在...

    B4A初级教程

    - **Running the Emulator through a proxy via the Command prompt(通过命令提示符使用代理运行模拟器)**: 提供解决方案来解决模拟器网络连接问题。 - **日历数据同步** - **Send data to Android calendar...

    新版Android开发教程.rar

    NTT DoCoMo, Inc. 日本多科莫电信 SOFTBANK MOBILE Corp. 日本软银移动 Sprint Nextel( 美国 ) T-Mobile( 德国 ) Telecom Italia( 意大利 ) Telef ó nica( 西班牙 ) Vodafone 沃达丰电信 China Unicom 中国联通 ...

Global site tag (gtag.js) - Google Analytics