Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adb install fails with error 'INSTALL_FAILED_INSUFFICIENT_STORAGE'

I have bought my first Android mobile Sony Xperia M without being aware of the issue that we can't move apps to external sd card. Refer this link for details.

The only thing Sony advice is to root the device, partition and use third party apps to move it. They also mention that rooting may void warranty.

My Android Details of Sony Xperia M is listed below

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

I have tried running the below commands from some forum and it is not working for me,

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

Though the above commands doesn't prompt any error and I can get the install location as 2 (with adb shell pm get-install-location). So I believe it has set properly. But then I tried installing some apps and it is only installing in the internal memory only.

I have tried 'apps2sd' utility to move my apps and it is showing the below error,

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

Finally from another forum, I understand that we can install apk files through 'adb install' command to install directly into the sd card as below,

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

The above command fails with this error,

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

I have enough space (more than 6GB out of total 8GB memory) in my external card. You can find this using below command,

>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

If I run the adb install command without '-s' switch, it installs fine in internal memory without any issues as below,

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

While installing to sd card, app seems to be installed in '/sdcard', but no mount of such thing there in 'df' command output. Also tried searching this 'INSTALL_FAILED_INSUFFICIENT_STORAGE' by google. Most of them asked to do some changes in emulator to get this done. I have uninstalled the app, restarted the device and tried installing again into sd card but not working ended with the same insufficient storage error.

I am not using emulator. I am just directly installing apk into my sd card. I dont want to root the device and void warranty offer.

Appreciate if some one could send your ideas on this.

like image 787
Prabu Avatar asked Apr 17 '14 05:04

Prabu


1 Answers

There is a simple workaround.If your test device is running Android 2.2 or later then add the

android:installLocation 

attribute to your application's manifest file, with the value "preferExternal". This will force the app to be installed on the device's external storage, such as a phone's SD card.

For example:

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dem"
    android:installLocation="preferExternal">
like image 170
Shekhar Sahu Avatar answered Oct 23 '22 11:10

Shekhar Sahu