Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 395
Don Rhummy Avatar asked Nov 25 '14 07:11

Don Rhummy


People also ask

What is difference between AVD and emulator?

Android Emulator allows you to run emulations of Android devices on Windows, macOS or Linux machines. The Android Emulator runs the Android operating system in a virtual machine called an Android Virtual Device (AVD). The AVD contains the full Android software stack, and it runs as if it were on a physical device.

Where are AVD files stored?

The default location is the following, where name is the AVD name: macOS and Linux - ~/.android/avd/ name .avd/ Microsoft Windows XP - C:\Documents and Settings\ user \.android\ name .avd\ Windows Vista, and higher - C:\Users\ user \.android\ name .avd\

How do I change Android Emulator storage?

Go to AVD manager on your android studio. click on the pencil icon of the virtual device. on the pop up window click on advanced settings at the bottom. scroll down to memory and storage and alter the default definitions of MB/GB etc.


1 Answers

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
like image 62
Don Rhummy Avatar answered Sep 30 '22 13:09

Don Rhummy