如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

时间:2021-12-22 18:55:20

I get this sometimes(not often) for one of my projects, couple of classes only
Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE

对于我的一个项目,我有时(不经常)会遇到这种情况,有几个类只有安装错误:install_failed_in自足_storage

How do I increase emulator's storage?

如何增加模拟器的存储?

19 个解决方案

#1


111  

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://*.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://*.com/a/35828035/62——这是一个很好的屏幕截图答案。如果您正在使用Android Studio,请忽略下面的Eclipse答案。

Original Eclipse-based Answer

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中,转到“调试配置”。您可以在“debug”图标下的下拉菜单中找到它。选择“target”,并选择要启动的首选仿真器目标。然后在“附加仿真器命令行选项”下,添加以下内容:

-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.

然后关闭仿真器(并删除任何设备),并单击debug图标,它将启动所选的首选仿真器。这很重要:Eclipse需要启动调试器,而不是AVD。

That fixed the problem for me.

这就解决了我的问题。

#2


36  

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 如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)
如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

我加了一行

#3


15  

On Android Studios

Open AVD Manager.

开放的AVD管理器。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Click Edit Icon to edit the AVD.

点击编辑图标来编辑AVD。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Click Show Advanced settings.

点击显示高级设置。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Change the Internal Storage, Ram, SD Card size as necessary. Click Finish.

根据需要更改内部存储,Ram, SD卡大小。单击Finish。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Confirm the popup by clicking yes.

通过单击yes确认弹出窗口。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Wipe Data on the AVD and confirm the popup by clicking yes.

删除AVD上的数据,单击yes确认弹出。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Now start and use your Emulator with increased storage.

现在启动并使用存储增加的模拟器。

#4


9  

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和adt15中的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 :

然后转到“Skin:”下面的“硬件属性”窗口,我可以用“硬件:新按钮的理想分区大小”进行选择。然而,我不能将值设为“0”。我毫不气馁,去了我家。android/avd目录有一个“MyVm”。avd的目录。进入那个目录,我发现了一个“配置”。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,选择“Start”,选择在下面的对话框中擦除用户数据,并能够运行和安装。

#5


6  

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仿真器映像中遇到过这个问题。

#6


5  

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

#7


5  

Run AVD Manager

运行AVD管理器

Select your AVD and click "Details..." button.

选择您的AVD并点击“Details…”按钮。

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 details”中按路径进入AVR的文件夹。

Edit it in config.ini to

编辑配置。ini,

disk.dataPartition.size=4000MB

and remove all .img files.

并删除所有.img文件。

#8


3  

<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

#9


3  

Just start emulator by command line as follow:

只需按命令行启动仿真器,如下所示:

emulator -avd <your avd name> -partition-size 1024 -wipe-data

#10


2  

I'm a beginner, but I had that problem while playing around with the "Hello Grid View". I was trying to use my own photos, which were all very large in file size.

我是个初学者,但我在玩“Hello Grid View”时遇到了这个问题。我试着用我自己的照片,这些照片的文件都很大。

The quick fix was to reduce the number of photos, thus reducing the size of the APK file.

快速修复是为了减少照片的数量,从而减少APK文件的大小。

But, I guess my follow up question for anybody else who hits this thread is this: How do I attach large files like JPGs and MP3s to an app and make sure they save on the SD Card so the APK remains small?

但是,我想我接下来要问的问题是:如何将jpg和mp3之类的大文件添加到应用程序中,并确保它们保存在SD卡上,从而使APK保持小?

#11


2  

you need to increase virtual memory of emulator

您需要增加仿真器的虚拟内存

How to increase virtual memory of emulator

如何增加仿真器的虚拟内存

emulator -avd "Emulator Name" -partition-size 2024

仿真器-avd“仿真器名称”-分割大小为2024

after then try to install your apk

然后尝试安装您的apk

#12


2  

Update your settings in AVD Manager and start the device by enabling 'Wipe user data'. This worked for me.

在AVD管理器中更新您的设置,通过启用“擦拭用户数据”启动设备。这为我工作。

#13


1  

I guess you should restart the emulator with "emulator -wipe-data -avd YourAvdName" or check "Wipe User Data" in run configuration if you are using Eclipse.

我猜您应该使用“仿真器-wipe-data -avd YourAvdName”重新启动仿真器,如果您正在使用Eclipse,则应该在运行配置中检查“擦拭用户数据”。

I am facing the same issue right now.

我现在正面临着同样的问题。

#14


1  

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卡图像可选:保存数据:

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 

#15


0  

The only time I've seen this happen it was when the host filesystem was basically out of space. Do you have much free space on the filesystem where the VM's filesystem is stored?

我唯一一次看到这种情况发生是在主机文件系统基本上没有空间的时候。在存储VM文件系统的文件系统上,是否有很多空闲空间?

#16


0  

It is defenetly not a appropriate answer, but it is a small hint.

这显然不是一个合适的答案,但这只是一个小小的暗示。

If you want to make use of static files in your App. You should put them as resources or as assets. But, if U have memory concerns like to keep your APK small, then you need to change your App design in such a way that,

如果你想在你的应用中使用静态文件,你应该把它们作为资源或资产。但是,如果你有记忆方面的问题比如让你的APK变小,那么你需要改变你的应用设计,

instead of putting them as resources, while running your App(after installation) you can take the files(defenately different files as user may not keep files what you need) from SD Card. For this U can use ContentResolver to take audio, Image files on user selection.

在运行应用程序(安装后)时,您可以从SD卡上获取文件(由于用户可能没有保存所需的文件,所以这些文件是完全不同的),而不是将它们作为资源。对于这个U可以使用ContentResolver来获取用户选择的音频、图像文件。

With this you can give the user another feature like he can load audio/image files to the app on his own choice.

有了这个,你可以给用户另一个功能,比如他可以在自己的选择上加载音频/图像文件到应用程序。

#17


0  

you can start the one when selecting one item from the left tree "virtual device" in AVD manager dialog on the platform of eclipse, the start UI has the option "Wipe User Data"

您可以在eclipse平台上的AVD manager对话框中从左树“虚拟设备”中选择一项时启动,start UI有“擦拭用户数据”选项

#18


0  

The following approach worked for me

下面的方法对我很有效

  1. Navigate to your android SDK/tools folder in the terminal window (in case you didn't added the path for it)

    导航到终端窗口中的android SDK/tools文件夹(如果没有添加路径)

  2. Make sure the virtual device you're planning to clean is powered off.

    确保你计划清理的虚拟设备已经关闭。

  3. Run the command "./emulator -wipe-data -avd YourAvdName" where YourAvdName is the name of your virtual android device

    运行该命令”。/模拟器-wipe-data - avdname虚拟android设备的名称

#19


0  

Try choosing project -> clean. A simple clean may fix it up.

尝试选择project -> clean。一个简单的清理就可以解决它。

#1


111  

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://*.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://*.com/a/35828035/62——这是一个很好的屏幕截图答案。如果您正在使用Android Studio,请忽略下面的Eclipse答案。

Original Eclipse-based Answer

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中,转到“调试配置”。您可以在“debug”图标下的下拉菜单中找到它。选择“target”,并选择要启动的首选仿真器目标。然后在“附加仿真器命令行选项”下,添加以下内容:

-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.

然后关闭仿真器(并删除任何设备),并单击debug图标,它将启动所选的首选仿真器。这很重要:Eclipse需要启动调试器,而不是AVD。

That fixed the problem for me.

这就解决了我的问题。

#2


36  

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 如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)
如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

我加了一行

#3


15  

On Android Studios

Open AVD Manager.

开放的AVD管理器。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Click Edit Icon to edit the AVD.

点击编辑图标来编辑AVD。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Click Show Advanced settings.

点击显示高级设置。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Change the Internal Storage, Ram, SD Card size as necessary. Click Finish.

根据需要更改内部存储,Ram, SD卡大小。单击Finish。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Confirm the popup by clicking yes.

通过单击yes确认弹出窗口。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Wipe Data on the AVD and confirm the popup by clicking yes.

删除AVD上的数据,单击yes确认弹出。

如何增加Android模拟器的存储空间?(INSTALL_FAILED_INSUFFICIENT_STORAGE)

Now start and use your Emulator with increased storage.

现在启动并使用存储增加的模拟器。

#4


9  

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和adt15中的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 :

然后转到“Skin:”下面的“硬件属性”窗口,我可以用“硬件:新按钮的理想分区大小”进行选择。然而,我不能将值设为“0”。我毫不气馁,去了我家。android/avd目录有一个“MyVm”。avd的目录。进入那个目录,我发现了一个“配置”。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,选择“Start”,选择在下面的对话框中擦除用户数据,并能够运行和安装。

#5


6  

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仿真器映像中遇到过这个问题。

#6


5  

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

#7


5  

Run AVD Manager

运行AVD管理器

Select your AVD and click "Details..." button.

选择您的AVD并点击“Details…”按钮。

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 details”中按路径进入AVR的文件夹。

Edit it in config.ini to

编辑配置。ini,

disk.dataPartition.size=4000MB

and remove all .img files.

并删除所有.img文件。

#8


3  

<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

#9


3  

Just start emulator by command line as follow:

只需按命令行启动仿真器,如下所示:

emulator -avd <your avd name> -partition-size 1024 -wipe-data

#10


2  

I'm a beginner, but I had that problem while playing around with the "Hello Grid View". I was trying to use my own photos, which were all very large in file size.

我是个初学者,但我在玩“Hello Grid View”时遇到了这个问题。我试着用我自己的照片,这些照片的文件都很大。

The quick fix was to reduce the number of photos, thus reducing the size of the APK file.

快速修复是为了减少照片的数量,从而减少APK文件的大小。

But, I guess my follow up question for anybody else who hits this thread is this: How do I attach large files like JPGs and MP3s to an app and make sure they save on the SD Card so the APK remains small?

但是,我想我接下来要问的问题是:如何将jpg和mp3之类的大文件添加到应用程序中,并确保它们保存在SD卡上,从而使APK保持小?

#11


2  

you need to increase virtual memory of emulator

您需要增加仿真器的虚拟内存

How to increase virtual memory of emulator

如何增加仿真器的虚拟内存

emulator -avd "Emulator Name" -partition-size 2024

仿真器-avd“仿真器名称”-分割大小为2024

after then try to install your apk

然后尝试安装您的apk

#12


2  

Update your settings in AVD Manager and start the device by enabling 'Wipe user data'. This worked for me.

在AVD管理器中更新您的设置,通过启用“擦拭用户数据”启动设备。这为我工作。

#13


1  

I guess you should restart the emulator with "emulator -wipe-data -avd YourAvdName" or check "Wipe User Data" in run configuration if you are using Eclipse.

我猜您应该使用“仿真器-wipe-data -avd YourAvdName”重新启动仿真器,如果您正在使用Eclipse,则应该在运行配置中检查“擦拭用户数据”。

I am facing the same issue right now.

我现在正面临着同样的问题。

#14


1  

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卡图像可选:保存数据:

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 

#15


0  

The only time I've seen this happen it was when the host filesystem was basically out of space. Do you have much free space on the filesystem where the VM's filesystem is stored?

我唯一一次看到这种情况发生是在主机文件系统基本上没有空间的时候。在存储VM文件系统的文件系统上,是否有很多空闲空间?

#16


0  

It is defenetly not a appropriate answer, but it is a small hint.

这显然不是一个合适的答案,但这只是一个小小的暗示。

If you want to make use of static files in your App. You should put them as resources or as assets. But, if U have memory concerns like to keep your APK small, then you need to change your App design in such a way that,

如果你想在你的应用中使用静态文件,你应该把它们作为资源或资产。但是,如果你有记忆方面的问题比如让你的APK变小,那么你需要改变你的应用设计,

instead of putting them as resources, while running your App(after installation) you can take the files(defenately different files as user may not keep files what you need) from SD Card. For this U can use ContentResolver to take audio, Image files on user selection.

在运行应用程序(安装后)时,您可以从SD卡上获取文件(由于用户可能没有保存所需的文件,所以这些文件是完全不同的),而不是将它们作为资源。对于这个U可以使用ContentResolver来获取用户选择的音频、图像文件。

With this you can give the user another feature like he can load audio/image files to the app on his own choice.

有了这个,你可以给用户另一个功能,比如他可以在自己的选择上加载音频/图像文件到应用程序。

#17


0  

you can start the one when selecting one item from the left tree "virtual device" in AVD manager dialog on the platform of eclipse, the start UI has the option "Wipe User Data"

您可以在eclipse平台上的AVD manager对话框中从左树“虚拟设备”中选择一项时启动,start UI有“擦拭用户数据”选项

#18


0  

The following approach worked for me

下面的方法对我很有效

  1. Navigate to your android SDK/tools folder in the terminal window (in case you didn't added the path for it)

    导航到终端窗口中的android SDK/tools文件夹(如果没有添加路径)

  2. Make sure the virtual device you're planning to clean is powered off.

    确保你计划清理的虚拟设备已经关闭。

  3. Run the command "./emulator -wipe-data -avd YourAvdName" where YourAvdName is the name of your virtual android device

    运行该命令”。/模拟器-wipe-data - avdname虚拟android设备的名称

#19


0  

Try choosing project -> clean. A simple clean may fix it up.

尝试选择project -> clean。一个简单的清理就可以解决它。