How to create SD card to use in Android Studio's emulator?

Viewed 27563

I need to download mp3 files to an sd card in Android Studio and then read them, firstly, how can i create an SD card for my emulator? Secondly, how can I add files to it? I'm a beginner so a step by step explanation would be welcome.

6 Answers

Android Studio 3.1.1

1.Create a emulator : Tools > AVD Manager , And run it

2.Open file system explorer :View > Tool Windows > Device File Explorer

3.In Device File Explorer : Click right button , u will see Upload and Save as

Step1:

enter image description here

Step2:

enter image description here Step3:

enter image description here

I had the same problem. I needed a lot of space for saving images in the emulator. My solution was creating an image sdcard and attach it to emulator. I followed these steps:

1 ) Create an image of external sdcard:

~/Library/Android/sdk/tools/mksdcard -l mySdCard 20G path/mySdCard.img

2 ) Create an emulator with the external sdcard:

~/Libarary/Android/sdk/tools/bin/avdmanager create avd -n EMULATOR_NAME -k “system-images;android-24;default;x86” -f -c path/mySdCard.img

3 ) I searched for the external storage path with adb shell because the path to push the files is not very intuitive.

My sdcard path is in storage/15F5-0C07/

4 ) Push the files into external storage path

~/Library/Android/sdk/platform-tools/adb push localPath  /storage/15F5-0C07

I wrote all of the steps because I searched a lot for pushing the files into external storage and not into internal storage

I did the following steps to create an external sdcard Image

Step 1: Navigate to your android sdk directory and to the following directory inside it.

/{your_androidSdk_location}/Android/sdk/emulator

Step 2: Ensure that there is a executable file named mksdcard.

Step 3: Create another directory to store the image file(.img file) that is going to be created in the next step. Lets call this directory as image_dir

Step4: Execute the following command

./mksdcard -l mylabel 1024M image_dir/sdcard.img

Now the .img file would have been created.

Step 5: Now edit your emulator in the AVD manager and select Advanced Settings , under the Memory and Storage section select external file radio button for Sd Card and choose the .img file that was created in step 4.

Happy emulated Storage

Related