【发布时间】:2026-01-02 08:15:01
【问题描述】:
我正在尝试使用默认的 android AVD 模拟器。它工作正常,但是我在使用外部存储/sdcard 时遇到了问题。
好像sdcard镜像根本没有挂载。
Environment.getExternalStorageState()
External: removed
这是我的配置
还有配置文件本身
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
请帮助解决这个问题。我试图重新创建一个虚拟设备,但这并没有解决问题
更新
这也不好用
./emulator -avd Nexus_4_API_16 -sdcard ~/Temp/mainSdCard.img
【问题讨论】:
-
配置文件清楚地表明它有 sd 卡。所以我认为问题出在你的代码上。
-
@Umair 问题不是我的代码,sd 卡甚至没有显示在设置中。
-
@bxfvgekd 你有什么可行的解决方案吗?我也有同样的问题。
-
@TruptiNasit,请看答案
标签: android android-emulator avd android-sdcard mount