How to Fix Missing SD Card on Android Emulator

Whilst testing an app on the Jelly Bean emulator, I couldn’t get the emulator to mount the SD card. Calls to Environment.getExternalStorageState() would always return Environment.MEDIA_REMOVED.

After some searching, I realised the found was being configured with hw.sdCard=no during creation, despite specifying an SD card in the UI.

To fix the issue, open up the config.ini for the affected emulator, and change the value to hw.sdCard=yes, e.g:

# ~/.android/avd/Nexus_5X_API_16.avd/config.ini
# ...
hw.sdCard=yes

After restart your emulator, it should now successfully mount the SD Card.

Need a technology partner?

We provide expert, independent consulting and development services to businesses using Ruby on Rails. We can help you at any stage of your project, from initial design and planning through to development, long-term support, maintenance, and scaling.