如何增加 Android Emulator 的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2239330/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to increase storage for Android Emulator? (INSTALL_FAILED_INSUFFICIENT_STORAGE)
提问by Pentium10
I get this sometimes(not often) for one of my projects, couple of classes onlyInstallation error: INSTALL_FAILED_INSUFFICIENT_STORAGE
我有时(不经常)为我的一个项目得到这个,只有几节课Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE
How do I increase emulator's storage?
如何增加模拟器的存储空间?
采纳答案by SomeCallMeTim
Update
更新
This answer is, as I write this, nearly eight years old, and about five years stale. But it's still (as I write this) the "accepted" answer, because it answered the question when it was asked.
在我写这篇文章的时候,这个答案已经快八岁了,大约五年了。但这仍然是(在我写这篇文章时)“接受”的答案,因为它在被问到问题时回答了这个问题。
The newer answer, that applies to the newer Android Studio tools, can be found here: https://stackoverflow.com/a/35828035/62-- it's a great answer with screen shots. If you're using Android Studio, ignore the Eclipse answer below.
适用于较新 Android Studio 工具的较新答案可以在这里找到:https: //stackoverflow.com/a/35828035/62——这是一个很好的屏幕截图答案。如果您使用的是 Android Studio,请忽略下面的 Eclipse 答案。
Original Eclipse-based Answer
原始的基于 Eclipse 的答案
I was searching for the answer to this question, and was unsatisfied with the above answers. But then I found the answer, so here it is for future reference:
我正在寻找这个问题的答案,对上述答案不满意。但后来我找到了答案,所以在这里供将来参考:
To summarize (and clarify), in Eclipse, go to "Debug Configurations". You can find that in the drop-down under the "debug" icon. Select "target", and select a preferred emulator target to launch. Then under "additional emulator command line options," add this:
总结(并澄清),在 Eclipse 中,转到“调试配置”。您可以在“调试”图标下的下拉菜单中找到它。选择“目标”,然后选择要启动的首选模拟器目标。然后在“其他模拟器命令行选项”下,添加以下内容:
-partition-size 1024
-分区大小 1024
Then CLOSE the emulator (and remove any devices), and click the debug icon, which will launch the preferred emulator you selected. This is important: Eclipse needs to launch the debugger, not AVD.
然后关闭模拟器(并移除所有设备),然后单击调试图标,这将启动您选择的首选模拟器。这很重要:Eclipse 需要启动调试器,而不是 AVD。
That fixed the problem for me.
那为我解决了问题。
回答by Cijo
On Android Studio
在 Android Studio 上
Open the AVD Manager.
打开 AVD 管理器。
Click Edit Icon to edit the AVD.
单击编辑图标以编辑 AVD。
Click Show Advanced settings.
单击显示高级设置。
Change the Internal Storage, Ram, SD Card size as necessary. Click Finish.
根据需要更改内部存储、Ram、SD 卡大小。单击完成。
Confirm the popup by clicking yes.
单击是确认弹出窗口。
Wipe Data on the AVD and confirm the popup by clicking yes.
擦除 AVD 上的数据并单击是确认弹出窗口。
Important:After increasing the size, if it doesn't automatically ask you to wipe data, you have to do it manually by opening the AVD's pull-down menu and choosing Wipe Data.
重要提示:增加大小后,如果它没有自动要求您擦除数据,您必须通过打开 AVD 的下拉菜单并选择擦除数据手动执行。
Now start and use your Emulator with increased storage.
现在启动并使用具有增加存储空间的模拟器。
回答by johndacostaa
Add the following to the avd config.ini
将以下内容添加到 avd config.ini
disk.dataPartition.size=1024MB
Let me know if this works for you also.
让我知道这是否也适用于您。
I added in the line
我在行中添加
回答by Proggear
Run AVD Manager
运行 AVD 管理器
Select your AVD and click "Details..." button.
选择您的 AVD,然后单击“详细信息...”按钮。
In my case AVD Manager sets disk size as
在我的情况下,AVD Manager 将磁盘大小设置为
disk.dataPartition.size=4000M
This invalid value, disk is approx 500MB despite numbers specified.
尽管指定了数字,但此无效值磁盘大约为 500MB。
Go to AVR's folder by path in "AVD details".
通过“AVD 详细信息”中的路径转到 AVR 的文件夹。
Edit it in config.ini to
在 config.ini 中将其编辑为
disk.dataPartition.size=4000MB
and remove all .img files.
并删除所有 .img 文件。
回答by billiam
I was doing an install of an apk:
我正在安装一个apk:
adb install /home/me/jones_android-arm.apk
And I was getting an error message telling me that
我收到一条错误消息告诉我
/data/local/tmp/jones_android-arm.apk
was too big. Using the sdk tools from r15, and ADT 15 I was able to use the AVD manager to manipulate some of my existing emulator's settings:
太大了。使用 r15 和 ADT 15 中的 sdk 工具,我能够使用 AVD 管理器来操作我现有的一些模拟器设置:
Window-> AVD Manager -> (select you virtual machine) -> Edit
then going to the Hardware properties window just below "Skin:" I was able to select with the Hardware: New button 'Ideal size of partition'. I was not, however, able to set the value other than to '0'. Undaunted, I went to my ${HOME}/.android/avd directory There was a 'MyVm.avd' directory. Going into that directory I found a 'config.ini' file. There was the entry :
然后转到“皮肤:”下方的硬件属性窗口,我可以使用硬件:新按钮“理想的分区大小”进行选择。但是,我无法将值设置为“0”以外的值。无所畏惧,我去了我的 ${HOME}/.android/avd 目录,那里有一个“MyVm.avd”目录。进入那个目录,我发现了一个“config.ini”文件。有条目:
disk.dataPartition.size=0
I set this to:
我将其设置为:
disk.dataPartition.size=1024
.. then went back to the AVD Manager, selected MyVm, selected 'Start', opted to wipe user data win the dialog following, and was able to run and install.
.. 然后回到 AVD 管理器,选择 MyVm,选择“开始”,选择擦除用户数据赢得以下对话框,并且能够运行和安装。
回答by binhgreat
Just start emulator by command line as follow:
只需通过命令行启动模拟器,如下所示:
emulator -avd <your avd name> -partition-size 1024 -wipe-data
回答by Lassi Kinnunen
avd manager has an option "ideal size of system partition", try setting that to 1024MB, or use the commandline launch option that does the same.
avd 管理器有一个选项“系统分区的理想大小”,尝试将其设置为 1024MB,或使用执行相同操作的命令行启动选项。
fyi, I only encountered this problem with the 4.0 emulator image.
仅供参考,我只在 4.0 模拟器映像中遇到过这个问题。
回答by Vishal Khakhkhar
this problem comes with android 1.5 .. try 2.0 or 2.1 or 2.2
这个问题出现在 android 1.5 .. 试试 2.0 或 2.1 或 2.2
回答by ankit kumar
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.junkfoodian"
android:installLocation="preferExternal" // this line can work for Installation error: // // INSTALL_FAILED_INSUFFICIENT_STORAGE
回答by user3099887
To resize the storage of the Android emulator in Linux:
要在 Linux 中调整 Android 模拟器的存储大小:
1) install qemu
1)安装qemu
2) Locate the directory containing the img files of the virtual machine. Something like ~/.android/avd/.avd and cd to it.
2) 找到包含虚拟机img文件的目录。类似于 ~/.android/avd/.avd 和 cd 到它。
3) Resize the ext4 images: i.e. for growing from 500Mb to 4Gb execute
3) 调整 ext4 图像的大小:即从 500Mb 增长到 4Gb 执行
qemu-img resize userdata.img +3.5GB
qemu-img resize userdata-qemu.img +3.5GB
4) grow the filesystem:
4) 扩展文件系统:
e2fsck -f userdata.img
resize2fs userdata.img
e2fsck -f userdata-qemu.img
resize2fs userdata-qemu.img
5) For the sd card image, optional: rescue the data:
5)对于sd卡镜像,可选:rescue the data:
mkdir 1
mount -o loop sdcard.img 1
cp -a 1 2
umount 1
6) resize the image from 100Mb to Gb:
6) 将图像从 100Mb 调整为 Gb:
qemu-img resize sdcard.img +3.9GB
7) re-generate the filesystem:
7)重新生成文件系统:
mkfs.vfat sdcard.img
8) optional: restore the old data:
8)可选:恢复旧数据:
mount -o loop sdcard.img 1
cp -a 2/* 1
mount -o loop sdcard.img 1