SD Card (created in AVD) shows as “removed” in Emulator for Android Studio

点点圈 提交于 2019-12-12 10:45:55

问题


I created a virtual device with an SD card (AVD Manager->Edit the device->Advanced Settings) but my app still shows it as not there:

//This prints: External: removed
Log.d(TAG, "External: " + Environment.getExternalStorageState() );

How do I get external storage to work?

I'm using:

Android Studio 0.8.14 Device: Nexus 5, 4.4 KitKat, CPU: x86


回答1:


In addition to creating an image for the SD card in the AVD Manager, you also need to manully edit the config file (this is a bug).

Find the emulator's configuration in your home directory:

#Located in:
~/.android/avd/<The_Device_Name>/config.ini

For example, on the Nexus 5 (created by Android Studio), it was:

~/.android/avd/Nexus5.avd/config.ini

Change the below setting to be:

hw.sdCard=yes


来源:https://stackoverflow.com/questions/27120754/sd-card-created-in-avd-shows-as-removed-in-emulator-for-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!