INSTALL_FAILED_INSUFFICIENT_STORAGE错误是每个Android开发人员的烦恼。这与应用程序大小或可用存储空间大小无关。重新启动目标设备可以短暂地修复问题,但它很快就会回来。人们在留言板上发帖询问为什么会出现这个问题,但令人沮丧的是,谷歌的人对这个问题保持沉默。

有一个简单的变通办法。如果您的测试设备运行的是Android 2.2或更高版本,那么将Android:installLocation属性添加到应用程序的清单文件中,值为“preferExternal”。这将迫使应用程序安装在设备的外部存储设备上,比如手机的SD卡。

例如:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.andrewsmith.android.darkness"
          android:installLocation="preferExternal"

这更像是一种创可贴,而不是补救措施,如果你想要完成的应用程序安装在设备的内部内存中,这可能不太理想。但它至少会让开发过程不那么令人沮丧。


当前回答

您需要增加Android模拟器的内存容量。有两种方法:

Right click the root of your Android Project, go to "Run As" and then go to "Run Configurations...". Locate the "Android Application" node in the tree at the left, and then select your project and go to the "Target" tab on the right side of the window look down for the "Additional Emulator Command Line Options" field (sometimes you'll need to make the window larger) and finally paste "-partition-size 1024" there. Click Apply and then Run to use your emulator. Go to Eclipse's Preferences, and then select “Launch” Add “-partition-size 1024” on the “Default emulator option” field. Click “Apply” and use your emulator as usual.

其他回答

我遇到这个问题是因为我使用Sideload Wonder Machine在我的实际手机上安装应用程序时遇到了这个错误。我发现问题是在/payload目录中有多个.apk文件。我认为这是支持的东西,但当我删除了所有的。apk,只有一个,错误消失了。

您需要增加Android模拟器的内存容量。有两种方法:

Right click the root of your Android Project, go to "Run As" and then go to "Run Configurations...". Locate the "Android Application" node in the tree at the left, and then select your project and go to the "Target" tab on the right side of the window look down for the "Additional Emulator Command Line Options" field (sometimes you'll need to make the window larger) and finally paste "-partition-size 1024" there. Click Apply and then Run to use your emulator. Go to Eclipse's Preferences, and then select “Launch” Add “-partition-size 1024” on the “Default emulator option” field. Click “Apply” and use your emulator as usual.

以下方法会有所帮助:

打开设备的外壳 亚行壳 导航到第一次复制传入APK的临时目录 cd /数据/地方/ tmp 列出可用的文件并根据需要删除 Rm * //使用风险自负,最好先列出文件

到目前为止,这对我来说在实际设备上是可靠的。


编辑:事实证明,这个解决方案不像上面的解决方案那么可靠。

我尝试了很多方法。没有什么真的有用。最后我找到了一个叫SD Maid的应用程序。帮助。

该公司表示,该功能在非root设备上受到限制。我的工作是根深蒂固的,所以很高兴看到人们在这些情况下是有效的,如果它对我有效只是一个侥幸(无论如何这是一个不可预测的问题)。

注意:我和这个应用程序没有任何关系,只是通过搜索找到的。

如果你使用的是真正的设备,你只是耗尽了内部内存。只需进入Android设置->应用程序,并移动一些应用程序到SD卡或卸载一些应用程序。

如果您正在使用模拟器,请参阅RacZo的回答。

解决办法很简单。

打开AVD管理器。编辑你的AVD。

在下面的硬件部分,有一些属性列在“New…”和“Delete”的右边。

新媒体。选择数据分区大小。设置为“512MB”(必须为MB)。做完了。如果您仍然遇到问题,请使用相同的方法增加您的系统和缓存分区。

都记录在这里: http://developer.android.com/guide/developing/devices/managing-avds.html