How to Fix Missing SD Card on Android Emulator

Chris Blunt

Chris Blunt · @cblunt

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.