19 May 2017 · About 1 minute read

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
# ...

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

Chris Blunt
Chris Blunt@cblunt
Chris is the founder of Plymouth Software. As well as code and business, he enjoys being a Dad, swimming, and the fine art of drinking tea.