Android模拟器不会挂载SD卡 [英] Android emulator won't mount SD card

查看:332
本文介绍了Android模拟器不会挂载SD卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Android Studio中运行虚拟机.问题在于它永远不会挂载SD卡. 在设置中,我尝试了由工作室管理(100MB)以及自己创建一个:

I'm running a virtual machine in Android Studio. The problem is that it is never mounting the SD card. In the settings, I've tried studio-managed (100MB) as well as creating one by myself:

$ ./mksdcard -l sdCard 100M sdcard.img

该文件位于我的主文件夹中,具有读写权限.

The file is in my home folder with R/W rights.

这是我的配置:

avd.ini.encoding=UTF-8
AvdId=DEVICEC_API_17
PlayStore.enabled=false
abi.type=x86
avd.ini.displayname=DEVICEC API 17
disk.dataPartition.size=800M
hw.accelerometer=no
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.manufacturer=User
hw.device.name=DEVICEC
hw.gps=no
hw.gpu.enabled=yes
hw.gpu.mode=auto
hw.initialOrientation=landscape
hw.keyboard=yes
hw.lcd.density=160
hw.mainKeys=no
hw.ramSize=1536
hw.sdCard=yes
hw.sensors.orientation=no
hw.sensors.proximity=no
hw.trackBall=no
image.sysdir.1=system-images/android-17/google_apis/x86/
runtime.network.latency=none
runtime.network.speed=full
sdcard.path=/home/user/sdcard.img
showDeviceFrame=no
skin.dynamic=yes
skin.name=800x600
skin.path=_no_skin
skin.path.backup=_no_skin
tag.display=Google APIs
tag.id=google_apis
vm.heapSize=48

如您所见,hw.sdCard设置为YES.

老实说,我不知道在Logcat中寻找什么.我正在过滤MOUNT:

Honestly I don't know what to look for in Logcat. Filtering MOUNT I saw this:

08-14 17:45:55.544 1495-1508/system_process I/SystemServer: Mount Service
08-14 17:45:55.544 1495-1508/system_process D/MountService: got storage path: /mnt/sdcard description: USB storage primary: true removable: false emulated: false mtpReserve: 0 allowMassStorage: false maxFileSize: 0
08-14 17:45:55.544 1495-1508/system_process D/MountService: addVolumeLocked() StorageVolume [mStorageId=0 mPath=/mnt/sdcard mDescriptionId=17040615 mPrimary=true mRemovable=false mEmulated=false mMtpReserveSpace=0 mAllowMassStorage=false mMaxFileSize=0 mOwner=null]
08-14 17:45:55.554 1495-1533/system_process D/MountService: volume state changed for /mnt/sdcard (null -> removed)
08-14 17:45:55.554 1495-1533/system_process W/MountService: getSecureContainerList() called when storage not mounted

我也尝试过在命令行中运行它:

I've also tried running this in the command line:

$ ./emulator -avd CASIO_API_17 -sdcard /home/mariano/sdcard.img

但是我没有看到任何错误. SD卡只是不会挂载.

But I don't see any error. The SD card just won't mount.

推荐答案

最近的模拟器版本似乎存在问题,可能与较旧的Android版本(Jelly Bean等)有关.

This seems to be an issue with the recent emulator version, possibly in relation with older Android versions (Jelly Bean, etc.).

将SDK工具降级到以前的版本即可解决此问题.

Downgrading the SDK tools to a previous version solves the issue.

例如,它与r25.2.5兼容,您可以从 Linux Mac OS X . 如果将工具存储在原始SDK目录之外,则可能需要设置ANDROID_SDK_ROOT环境变量.

It works for example with r25.2.5, which you can download for Windows, Linux, or Mac OS X. If you store the tools outside of the original SDK directory you may need to set the ANDROID_SDK_ROOT environment variable.

然后使用此软件包随附的仿真器可执行文件来启动您的AVD:

Then use the emulator executable shipped with this package to start your AVD:

$ ./emulator -avd CASIO_API_17 -sdcard /home/mariano/sdcard.img

这篇关于Android模拟器不会挂载SD卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆