Reputation:
I am trying to use default android AVD emulator. It works fine, however I have a problem with using external storage/sdcard.
It seems that the sdcard image is not mounted at all.
Environment.getExternalStorageState()
External: removed
Here is my configuration
And the config file itself
avd.ini.encoding=UTF-8
AvdId=Nexus_4_API_16
PlayStore.enabled=false
abi.type=x86
avd.ini.displayname=Nexus 4 API 16
disk.dataPartition.size=800M
hw.accelerometer=yes
hw.audioInput=yes
hw.battery=yes
hw.camera.back=emulated
hw.camera.front=emulated
hw.cpu.arch=x86
hw.cpu.ncore=4
hw.dPad=no
hw.device.hash2=MD5:6930e145748b87e87d3f40cabd140a41
hw.device.manufacturer=Google
hw.device.name=Nexus 4
hw.gps=yes
hw.gpu.enabled=yes
hw.gpu.mode=auto
hw.initialOrientation=Portrait
hw.keyboard=yes
hw.lcd.density=320
hw.mainKeys=no
hw.ramSize=1536
hw.sdCard=yes
hw.sensors.orientation=yes
hw.sensors.proximity=yes
hw.trackBall=no
image.sysdir.1=system-images/android-16/google_apis/x86/
runtime.network.latency=none
runtime.network.speed=full
sdcard.size=1000M
showDeviceFrame=yes
skin.dynamic=yes
skin.name=nexus_4
skin.path=/Users/user/Library/Android/sdk/skins/nexus_4
tag.display=Google APIs
tag.id=google_apis
vm.heapSize=80
Please help to solve this problem. I have tried to recreate a virtual device, however this didn't solve the problem
UPDATE
This doesn't work as well
./emulator -avd Nexus_4_API_16 -sdcard ~/Temp/mainSdCard.img
Upvotes: 2
Views: 4010
Reputation: 2125
Appears to be a known bug with some (currently latest) emulator versions, Android Studio 2.3+, when running older Android versions, e.g. API 15-18.
https://issuetracker.google.com/issues/37138030
It's happening for me on emulator 27.1.10-4607264 (latest as of writing) with Android Studio 3.0.1. I can't get any workaround to work at present, and haven't figured out how to get an older emulator version to run either.
Using API 19 (Android 4.4) or newer works, but is obviously not a great solution if you want to test operation on older Android verions.
Upvotes: 1
Reputation:
The only one solution I have found is just to test different emulators.
Currently I am using Nexus 5x with Android 4.3
and it works fine.
Another possible solution that may help someone is after you have created an emulator, stop it and change the size of the sdcard generated by default by Android Studio.
I hope this will help.
Upvotes: 4