Android simulator uses analog SD card

Source: Internet
Author: User

Debugging related to SD card is often encountered in andorid development, such as MP3 files and image files.

When developing a simulator, you can simulate an SD card through a hard disk. The specific method is:

 

1. Create an SD card image file

Open CMD and enter the C root directory. Run the following command: mksdcard 1024 M sdcard. img
This command will generate an sdcard. imgfile under the current directory (I am the root directory of the C drive), which is the SD card image file of the android simulator.
1024 MB indicates 1024 MB, that is, the SD card has 1 GB capacity, and K can also be used as the unit (1 m = K). K and m must be capitalized.
Android currently supports 8 m ~ Gb sd card.

 

2. Associate SD card and Simulator

It is to let the simulator know who the SD card is and what the path is.

The ADT plug-in is used in eclipse. Eclipse> Windows> Android AVD manager. A window is displayed,

Enter C:/sdcard. IMG in the box after sdcard, which is the location of the SD card image file created in step 1. First click Create AVD,

Click Finish.

 

3. Export files to the SD card
In this step, you need to run the simulator.

In cmd, the command is as follows: ADB push testbench sdcard/testbench

This will copy the testbench file under the current directory to the sdcard without changing the file name. The first testrunner is the path of the local file, and the sdcard is the name of the target SD card image (remove the suffix ).

 

4. Use the files in the SD card in the simulator

After the file is imported, if you want to access it in the simulator, you also need to scan the media file in the dev tools in the simulator or manipulate the files in the SD card according to a file manager tool.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.