android – adb install失败,错误为’INSTALL_FAILED_INSUFFICIENT_STORAGE’

我已经购买了我的第一部Android手机索尼Xperia M而没有意识到我们无法将应用程序移动到外部SD卡的问题.有关详细信息,请参阅此link.

索尼的唯一建议是根据设备,分区并使用第三方应用来移动设备.他们还提到生根可能会使保修失效.

我的Android Xperia M详细信息如下所列

Model number C1904
Android version 4.1.2
Build number 15.1.C.2.8

我试过从一些论坛运行以下命令,它对我不起作用,

adb devices
adb shell pm get-install-location
adb shell pm set-install-location 2

虽然上面的命令没有提示任何错误,但我可以将安装位置设置为2(使用adb shell pm get-install-location).所以我相信它设置得当.但后来我尝试安装一些应用程序,它只安装在内部存储器中.

我试过’apps2sd’实用程序移动我的应用程序,它显示以下错误,

'The device does not have a real primary external storage,or the primary external storage is emulated. Moving app to SD function cannot be supported by this device.'

最后来自另一个论坛,我了解到我们可以通过’adb install’命令安装apk文件直接安装到sd卡中,如下所示,

adb install -s C:\com.furkan0gul.mvanparking.apk

上面的命令失败,出现此错误,

3531 KB/s (13523837 bytes in 3.740s)
        pkg: /sdcard/tmp/com.furkan0gul.mvanparking.apk
Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]

我的外卡中有足够的空间(总共8GB内存超过6GB).你可以使用下面的命令找到它,

>adb shell df
Filesystem              Size    Used    Free   Blksize
/dev                    402M     64K    402M   4096
/mnt/asec               402M      0K    402M   4096
/mnt/obb                402M      0K    402M   4096
/system                1183M    907M    275M   4096
/cache                  246M      4M    241M   4096
/persist                  3M     80K      3M   4096
/firmware                63M     43M     19M   16384
/data                  2101M   1401M    700M   4096
/lta-label               15M      4M     10M   4096
/storage/sdcard0       2101M   1401M    700M   4096
/storage/sdcard1       7572M   1088M   6483M   32768

如果我运行没有’-s’开关的adb install命令,它在内部存储器中安装正常,没有任何问题,

> adb install C:\com.furkan0gul.mvanparking.apk
2549 KB/s (13523837 bytes in 5.180s)
        pkg: /data/local/tmp/com.furkan0gul.mvanparking.apk
Success

在安装到SD卡时,app似乎安装在’/ sdcard’中,但在’df’命令输出中没有安装这样的东西.还尝试通过谷歌搜索此“INSTALL_FAILED_INSUFFICIENT_STORAGE”.他们中的大多数人都要求在模拟器中做一些更改才能完成这项工作.我已经卸载了应用程序,重新启动了设备,并尝试再次安装到SD卡但不能正常工作以相同的不足存储错误结束.

我没有使用模拟器.我只是直接安装apk到我的SD卡.我不想根植设备并使保修提供无效.

感谢有人可以就此发表您的想法.

最佳答案
有一个简单的解决方法.如果您的测试设备运行Android 2.2或更高版本,然后添加

android:installLocation 

属性到应用程序的清单文件,值为“preferExternal”.这将强制将应用程序安装在设备的外部存储设备上,例如手机的SD卡.

例如:

 

相关文章

文章浏览阅读1.8k次,点赞63次,收藏54次。Linux下的目录权限...
文章浏览阅读1.6k次,点赞44次,收藏38次。关于Qt的安装、Wi...
本文介绍了使用shell脚本编写一个 Hello
文章浏览阅读1.5k次,点赞37次,收藏43次。【Linux】初识Lin...
文章浏览阅读3k次,点赞34次,收藏156次。Linux超详细笔记,...
文章浏览阅读6.8k次,点赞109次,收藏114次。【Linux】 Open...