adb install fails with error 'INSTALL_FAILED_INSUFFICIENT_STORAGE' - android

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.

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

I have a Fairphone (first edition) with applied unified storage. The INSTALL_FAILED_INSUFFICIENT_STORAGE problem should have been gone with the unified storage. Nevertheless, it showed up after a few month despite having 12gb of free disk space. For me, the following steps solved the issue
Install an ssh server on your phone
Login
su (in case you're not root)
pm set-install-location 1 (set to external memory)
Since I HAVE enough space on the internal memory, this is preferred over the external memory (which I probably don't have anymore due to the unified storage). This might be specific to the Fairphone

Related

Resize data partition which does not match physical storage size after installation of Android stock and Lineage

After an attempt to install Lineageos+Magisk on a Xiaomi Mi A1, ended in a boot loop,
I installed stock from tissot_images_V10.0.9.0.PDHMIXM_20190514.0000.00_9.0_3ded3e7b82.tgz with containing flash_all.sh which applies fastboot. I got a working starting point with a tidy a/b partitioning.
I flashed Lineage, addonsu and stock camera with a temporary (unflashed) TWRP
Everything works well but there is too little storage, Lineage displays a size of 32GB instead of 64GB
df tells me: /dev/block/mmcblk0p49 19092180 15660496 3431684 83% /data
but blockdev --getsize64 /dev/block/mmcblk0p49 reports 55087439360 (bytes)
I mounted the userdata.img from the stock firmware mentioned above on my Linux PC and df showed me
/dev/loop1 19092180 118172 18762328 1% /mnt/...
This seems to be the source of the problem, isn't it?
(How) can I resize the partition / file system (preferably) without loosing data)?
I found a solution for my problem.
TWRP has added resize2fs to its features:
https://www.theandroidsoul.com/twrp-2-8-7-0-introduces-resize2fs-feature-to-fix-incorrect-storage-space-available-on-a-device/
So I started TWRP
sudo fastboot boot twrp-3.3.0-1-tissot.img
In TWRP I launched command line and with a single command
resize2fs /dev/block/mmcblk0p49 <newsize>
the problem was solved. I did not extend to the full size of the partition but left some MBs (at the end) because I seem to remember having read that this space is necessary for meta data when encrypting the device.

"mount: Invalid argument" on Android

I'm trying to mount an ext4 partition located on my SD card with the following:
# mount -t ext4 /dev/block/mmcblk1p2 /data/sdext2
But it always returns "Invalid argument". I've verified that ext4 is supported through /proc/filesystems.
Ideas on how to troubleshoot?
Turns out the SD card I bought from eBay was fake. It was packaged and branded as a 32gb card but the real capacity was 16gb. That's why it failed every time I tried to do 16gb FAT32 and 16gb EXT4. There wasn't any room for the second partition.
If I do 8gb each, it starts working again. Also works if I use a different card.

ADB - failure of installing apk on android device that has 0.00b internal storage while it has free space?

I have changed my I9070 firmware and the Internal Storage 0.00B and can't install apps and save files.
In order to fix the problem I have tried to install busy box but not succeeded.
c:\adb>adb devices
List of devices attached
C074114C31720D21CD73F6306E34174 device
c:\adb>adb shell
$ su
# su
# exit
# exit
$ exit
c:\adb>adb install busybox.apk
3264 KB/s (2679743 bytes in 0.801s)
pkg: /data/local/tmp/busybox.apk
Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
rm failed for -f, No such file or directory
Is there any help regarding this or other option?
As the error states it didnot have enough memory for installation either increase memory or delete some data and then try.
Thank you
You cannot install any app with 0B.
Now to your issue im not sure why the internal memory is 0B. either you format your device and see,or restart and check if it changes
Fix From Another Post
I found a solution, hopefully this can help someone in the future
The problem was i installed busybox using an installer which causing some file discrepancies.
To fix it :
1. Install Android Terminal Emulator, this app can be installed even if storage shows full. If you cant install the terminal use Uniflashv2 (open uniflashv2 and connect your device with the debug usb on, go to rom modding, then file manager)
copy /system/xbin/busybox to /system/bin, if busybox is installed the code is "busybox cp /system/xbin/busybox to /system/bin"
power off then power on (reboot)
When I did the above, all my previous apps and setting came back to normal
Source

Google Play Store insufficient storage error

I own a rooted Samsung Galaxy Tab 2 7.0 (GT-P3110). Im using Android 4.2.2 and Cyanogenmod 10.1.3-p3110.
Since a few days my tablets play store screws up installing some apps. I get an insufficient storage error after the installprocess starts everytime (when the download has ended). This occurred with youtube but strangely enough not with some barcodescanner app. When I look at my usage of internal storage however there seems to be more than 2 gigs of free space left.
The internet is full of people getting this error. I tried many solutions, but none of them seem to work. I tried to wipe the cache and dalvik cache. Also I tried to look at the free internal storage in different ways. Nothing seems to work. However I can put apks on my tablet via usb and then install them without any problems. This isnt really practical though.
Also updates are going fine too. I dont get this error when apps update automatically.
Edit: Also tried to fix permissions in Clockwordmod Recovery, didn't help
Edit 2: A copy of df command in terminal
u0_a40#android:/ $ su
u0_a40#android:/ # df
Filesystem Size Used Free Blksize
/dev 387.4M 48K 387.3M 4096
/storage 387.4M 0K 387.4M 4096
/storage/emulated 387.4M 0K 387.4M 4096
/storage/sdcard1 23.9G 32K 23.9G 16384
/mnt/secure 387.4M 0K 387.4M 4096
/mnt/asec 387.4M 0K 387.4M 4096
/mnt/obb 387.4M 0K 387.4M 4096
/mnt/fuse 387.4M 0K 387.4M 4096
/system 1.3G 374.9M 1003.1M 4096
/efs 19.7M 4.1M 15.5M 4096
/data 4.6G 2.5G 2.1G 4096
/cache 689M 70M 619M 4096
/mnt/shell/emulated 4.6G 2.5G 2.1G 4096
/storage/emulated/0 4.6G 2.5G 2.1G 4096
/storage/emulated/0/Android/obb 4.6G 2.5G 2.1G 4096
/storage/emulated/legacy 4.6G 2.5G 2.1G 4096
/storage/emulated/legacy/Android/obb 4.6G 2.5G 2.1G 4096
u0_a40#android:/ #
Navigate to settings->Apps->Running Apps and select "Google Play Services" click on uninstall latest updates and things should work again.This is a bug from google play and it creates multiple copies of your app directory in memory.
Going to Settings > Apps > Choose Google Play Services and then Clear Cache, worked for me!
Ended up flashing a new rom. I am using Slimkat 4.4.4 now and had to flash it using the latest Philz Touch which I found right here https://goo.im/devs/philz_touch/CWM_Advanced_Edition/p3110/
The problem now seems to have been solved, although I didnt prefer this particular solution. Oh well.
As far as I know, the only known "solution" for non-rooted devices whose cache and app data have already been wiped is to apply a factory reset.
If you change your mind and decide to root your phone, I suggest you install Android SDK Tools Only on your computer, then root your phone, go to Android's Settings, then Developer Options, then activate USB Debugging. After you do this, use a USB cable to connect your Android device to the computer where you installed the SDK tools.
The SDK tools have ADB (Android debugger). Open a shell window, go to the folder where the SDK tools were installed, look for a folder named platform-tools and access it. Inside this folder there will be an executable binary file named adb (or adb.exe, if you're using Windows). Then run the following command in order to make ADB access the command prompt of your Android device:
adb shell
Now that you're in your Android device shell (commands interpreter), run this command in order to become root (also known as superuser):
su -
Afterwards, run this command to check what's your system's default APK install location:
pm get-install-location
If the command above returns 2, it means that the Android package manager (pm) is incorrectly configured to install APKs in your external storage (e.g. microSD card) instead of in your device's internal storage (which is the correct one).
In order to fix it, run this command:
pm set-install-location 1
1 means internal storage media.
Now restart your device with this command:
reboot

Unable to change permission of the sdcard(emulator),can any1 guide me how to change them?

the permission of my sdcard is Irwxrwxrwx
i am unable to push any files in it
Android Emulator sdcard push error: Read-only file system
how to change permission of DDMS / File Explorer / sdcard?
Change file permissions in DDMS (Android)
i have gone through many questions some of them have been posted above,they didn't help..
i even tried getting an image from a friend,with read/write permissions but that didn't help either.
Sometimes the problem comes for something simpler: my SD Card was FAT32 formated and this problem finished when I changed the filesystem to NTFS.
You first need to create an SD Card image. This can be done in the AVD Manager at the same time as creating the AVD image.
The SD Card image has to be mounted too (i.e. if you use an already mounted SD Card). When no card is mounted, /sdcard is treated as a folder of /system. So when you try to write to /sdcard on an AVD image without an SD Card mounted it tries to write to /system which is read-only.
Update:
Make sure your SD card is mounted correctly. Use adb shell (or adb shell emulator-5554 when your real device is also plugged in) and enter df in the shell.
The output should look like this
Filesystem Size Used Free Blksize
/dev 378M 32K 378M 4096
/mnt/asec 378M 0K 378M 4096
/mnt/obb 378M 0K 378M 4096
/system 194M 191M 2M 4096
/data 194M 8M 185M 4096
/cache 64M 1M 62M 4096
/mnt/sdcard 246M 6K 246M 512
/mnt/secure/asec 246M 6K 246M 512
Make sure that this two lines are present.
/mnt/sdcard 246M 6K 246M 512
/mnt/secure/asec 246M 6K 246M 512
This means, that the SD Card is mounted correctly.
That being said: DO NOT IN ANY CASES NEVER EVER USE HARDCODED /sdcard/... PATHES. Always use Envirnoment.getExternalStorageDevice() (for multi-user) or Environment.getExternalStoragePublicDirectory (String type) (for public folders accessible to all users)
For Clarification: The SD Card is mounted in a different physical path depending on manufacturer of the ROM. Back when Android first appeared, all external cards where mounted by default in /sdcard since back then all devices had small internal memory and SD-Card slots.
Newer Android Smartphones often ship without an SD Card. The newerones with 1-16 GB internal memory, like tablets, do not mount to /sdcard instead they mount by default to /mnt/sdcard. But it also depends on vendors. One vendor use one way over the other way. Tablets w/o SD Card for example use part of the internal storage to mount to the old /sdcard for compatibility reasons. Always use the API to get the path to internal storage memory!
Envirnoment | Android Developers
http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory%28%29
or
http://developer.android.com/reference/android/os/Environment.html#getExternalStoragePublicDirectory%28java.lang.String%29

Categories

Resources