Method of adding files to sd card by Android simulator

  • 2021-07-22 11:23:45
  • OfStack

This paper describes the method of adding files to sd card by Android simulator. Share it for your reference, as follows:

Add files directly to the sd card in DDMS. If there is an error similar to: Failed to push XXXXX. txt on emulator-: Read-only file system, the reason is that your sdcard permissions are insufficient and you need to create an SDCARD directly.

1. Create SDCARD first. The name I created sdcard is: sdcard. img (take the name at will and end with the suffix img)

Enter DOS and point to the directory E:\ android-sdk_r10-windows\ android-sdk-windows\ tools (this is the file of SDK where android is installed, so configuring this environment variable is unnecessary)

We enter in Dos:


mksdcard -l sdcard 100M E:\sdcard\sdcard.img

(This file can be placed wherever you want.)

Commentary:

1. The sdcard command can use three sizes: bytes, K, and M. If only numbers are used, it means bytes. It can also be followed by K, such as 262144K, which also means 256M.

2. sdcard creates virtual files with a minimum of 8M, which means that the emulator only supports virtual files larger than 8M.

3. The-l command-line parameter represents the volume label of the virtual disk and may not be present.

4. The suffix of the virtual file. img

You can enter mksdcard Help in Dos

2. After creating the sdcard, we load the sdcard in the emulator

Window-"AVD Manager-" Select the emulator you are using-"Edit

Then select File in the SD Card options, then select the newly created sdcard. img, and then click ES90AVD to save

3. At this time, it is no problem to add files to the sdcard of the emulator (Note: It is best to restart the emulator for 1 time here)

4. After restarting the emulator, find Dev Tools in the emulator and start it, then find and run Media Scanner to scan the newly added files, and display "finished" to exit. At this time, the added files can be used (for example, MP3 files, then the music player can be found).

For more readers interested in Android, please check the topic of this site: "Android Thread and Message Mechanism Usage Summary", "activity Operation Skills Summary of Android Programming", "Android Debugging Skills and Common Problem Solutions Summary", "Android Development Introduction and Advanced Tutorial", "Android Multimedia Operation Skills Summary (Audio, Video, Recording, etc.)", "Android Basic Component Usage Summary", "Android View View Skills Summary", "Android Layout layout Control Usage Summary"

I hope this article is helpful to everyone's Android programming.


Related articles: