简体   繁体   中英

Android: How to create an AVD with an external sd card?

I'd like to create an Android Virtual Device against which I can test recent issues with writing to external SD cards. I would expect the external sd card to be found at location like "/storage/extSdCard/DCIM/" on the AVD's file system. Any suggestions on how I can accomplish this?

To add removable storage to your AVD use:

 ~/Android/android-sdk/tools/mksdcard [memory size] [output file] 

to create SD card image.

Then pass it in Advanced AVD Settings dialog: SD card -> External file

DONE :)

You can learn more about the mksdcard tool here: https://developer.android.com/studio/command-line/mksdcard

You can open Android Device Monitor which is the Android symbol next to the SDK Manager. Once opened you can see the files using the file explorer and here you can create the required folders/path for using the external SD card.

There is a chance that when you try and create a folder it will say it is read only, if this happens open up command prompt and using adb shell input these commands:

mount -o rw,remount rootfs /
chmod 777 /mnt/sdcard
exit

These commands are from this link

On macOS Mojave 1.14.3 with Android Studio 3.3.1 I found the path to be slightly different.

Create a 128 Gb sdcard:

~/Library/Android/sdk/tools/mksdcard 128G sdcard.ini

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM