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.
👋 Thanks for reading - I hope you enjoyed this post. If you find it helpful and want to support further writing and tutorials like this one, please consider supporting my work with a coffee!
Support ☕️