简体   繁体   English

无法增加Android模拟器内部存储

[英]Can Not Increase Android Emulator Internal Storage

I can't increase android emulator internal storage more than 533 MB even I already tried: 我无法增加Android模拟器内部存储超过533 MB,即使我已经尝试过:

  1. Edit disk.dataPartition.size=1G in config.ini file 在config.ini文件中编辑disk.dataPartition.size = 1G
  2. change the configuration on Android Virtual Device Manager like screen shoot below. 更改Android虚拟设备管理器上的配置,如下面的屏幕截图。

But the android emulator internal storage still 533 MB 但android模拟器内部存储仍然是533 MB

在此输入图像描述 My setting for emulator 我的模拟器设置

  1. android studio 1.3.1 android studio 1.3.1
  2. Nexus 5 emulator profie Nexus 5模拟器专业版
  3. Target sdk 5.1.1 目标sdk 5.1.1
  4. cpu x86_64 cpu x86_64

You can resolve this resizing the userdata.img file located on your avd emulator folder: 您可以解决此问题,调整位于avd模拟器文件夹中的userdata.img文件的大小:

cd ~/.android/avd/yourEmulatorName
e2fsck -f userdata-qemu.img
rm userdata-qemu.*
resize2fs userdata.img 1024M

Now start your avd emulator again and you'll see that it's storage was increased. 现在再次启动你的avd模拟器,你会看到它的存储空间增加了。 Windows users can do this with Cygwin enabling the "e2fsprogs" package on install/update. Windows用户可以使用Cygwin在安装/更新时启用“e2fsprogs”软件包。

PS: You must change 1024M to your wanted value of internal storage. PS:您必须将1024M更改为您想要的内部存储值。

UPDATE UPDATE

The e2fsck is not really necessary, as pointed on comments by @BoD . 正如@BoD的评论所指出的那样, e2fsck并不是必需的。

So all you need to increase the internal storage is run two commands on your target emulator folder. 因此,增加内部存储所需的只是在目标模拟器文件夹上运行两个命令。

In other words, you must: 换句话说,你必须:

  1. Delete the old emulator images 删除旧的模拟器图像
  2. Resize the userdata image file to wanted value 将userdata图像文件的大小调整为所需的值
cd ~/.android/avd/yourEmulatorName
rm userdata-qemu.*
resize2fs userdata.img 1024M

我尝试了很多时间来增加现有avd的内部存储但是没有成功,答案是:删除当前的avd并在创建它时设置内部存储

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM