28

I'm getting "Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE" error while installing the application on my device today. It is working fine till yesterday, today only im facing this problem. I have deleted some files on my SD card, but still facing the issue. I'm sure it is not the issue with the space on SD card. Can anybody suggest how to resolve this.

--nehatha

Venkat Papana
  • 4,447
  • 11
  • 46
  • 70
  • Are you sure it's about space on SD card more than internal memory ? – Snicolas Aug 20 '11 at 16:59
  • 1
    go ahead and move some application from internal memory to SD card or delete some application that are hogging the internal memory. – PravinCG Aug 20 '11 at 17:02
  • See this post http://stackoverflow.com/questions/2239330/how-to-increase-storage-for-android-emulator-install-failed-insufficient-storag – Noel Aug 20 '11 at 18:42
  • If it's not the SD card it must be some other sort of memory. For example the phone memory. How much space do you have on the phone? My guess - and it's just a guess - is that there's insufficient storage there. –  Aug 20 '11 at 19:43
  • It maybe battery related, at least for me. http://stackoverflow.com/a/10963431/3047840 – Fanglin Mar 17 '14 at 21:50

15 Answers15

73

It got resolved by having android:installLocation="preferExternal" for <manifest> tag of manifest file.

Like below:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="bros.imaq.demilic"
    android:versionCode="1"
    android:versionName="1.0"
    android:installLocation="preferExternal">

Thank you

Musarrat Saeed
  • 83
  • 1
  • 1
  • 11
Venkat Papana
  • 4,447
  • 11
  • 46
  • 70
  • Thanks for this! Also, this thread may be useful to people using the above solution: http://stackoverflow.com/questions/3213427/not-able-to-use-new-resource-identifiers-in-android-with-targetsdkversion-define – mal Mar 18 '12 at 10:35
  • i got this msg in manifest file:-> error: No resource identifier found for attribute 'installLocation' in package 'android' Pls help – someone_ smiley Jul 06 '12 at 08:24
7

You need to do two things after which this error will be resolved.

  1. In your AndroidManifest.xml file add android:installLocation="preferExternal" within your manifest tag.

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.packagename.appname"
    android:versionCode="1"
    android:versionName="1.0" 
    android:installLocation="preferExternal">
    
  2. More importantly, clear the cache data in your device. Goto settings -> storage -> click on cached data. This will clear the cache and free the space.

  3. Reconnect your device, clean your project and again run it on the device. The project will now run on your device.

Pang
  • 8,605
  • 144
  • 77
  • 113
Kaveesh Kanwal
  • 1,660
  • 15
  • 16
4

In my case the solution using the manifest tag didn't work, as there was no Android resource for that tag.

What did work was simply uninstalling the app on the phone. And the few other versions I had installed simultaneously.

Wytze
  • 7,494
  • 8
  • 46
  • 61
3

fixed my issue. problem was that i had set the set the install location via adb on my rooted KitKat 4.4.2 phone at one time, to put my apps on an SD Card:

adb shell
pm set-install-location 2

Said card was cheap and failed. even if i set the default location to the internal SD card, even if i removed the "damaged" (cheap and useless) SD card, i could now install no apps... but all is well now, the solution was to run

pm set-install-location 2
mahesh
  • 227
  • 2
  • 8
  • I see `Error: java.lang.SecurityException: Package android does not belong to 2000` when I run this command, unfortunately. Running on an Xperia Z2, non-rooted, Android 5.0. – Malcolm Crum Mar 18 '16 at 09:33
2

I tried many things from this thread and many others but in my case nothing would fix it'd keep popping with that message , for me what it did it was go to Applications>Google Play Services and clear the data there.

I'm at GooglePlayServices 7.3.29 and was debugging on this old Galaxy S1

becker
  • 353
  • 4
  • 8
1

In my case, I was running on an emulator and my app was crashing due to accessing a stale local reference in native code. That is most likely irrelevant but I mention it in case the crashes contribute to the problem. Based on advice related to INSTALL_FAILED_INSUFFICIENT_STORAGE, I'm now diligent in using the PM to uninstall my application after these crashes:

adb shell pm uninstall <my-application-package>

Most of the time, this seems to reset the state of the emulator so that I can upload/install/launch the next time.

I had the experience with an .APK that was briefly very large (~60Mb). Because the emulator really needs 3x the size of the APK available (1x to upload to /data/local/tmp, 2x to keep the installed -1.apk and -2.apk copies in /data/app), this was a problem when my emulator had limited internal storage.

I also make it a habit in these cases to delete the default packages in /data/app

adb shell rm /data/app/*

And to delete any residual files I may have pushed to /data/local/tmp

adb shell rm /data/local/tmp/*

Even with these measures, I have experienced INSTALL_FAILED_INSUFFICIENT_STORAGE despite apparently having sufficient free space (as reported by du and df). So, there seems to be some residual configuration cruft. In these cases, I have to Wipe Data from the emulator image using AVD.

Community
  • 1
  • 1
Jim Reesman
  • 196
  • 1
  • 6
1

In my case with regards to INSTALL_FAILED_INSUFFICIENT_STORAGE. I had to go and edit my AVD Internal and SD Storage size of my device under Android Virtual Deviece Manager. I increase the Internal Storage from 200 to 2000, and SD Card also to 2000. And add the android:installLocation="preferExternal" in my AndroidManifest.xml file

And it worked for me.

King
  • 214
  • 1
  • 17
1

I was unable to uninstall the app as it was not present in the app list. I had to delete the library file from /data/app-lib

then installed the app again. adb install

Adibas03
  • 350
  • 1
  • 8
1

When external storage is not available and it's not about storage space, rebooting real device fixes this error.

My log shows these lines :

PackageManager: Package ... could not be assigned a valid uid
PackageManager: package setting is null
PackageManager: Skipping remove dir for ...(user:0, appId:null)
PackageManager: Package couldn't be installed in /data/app/...
PackageManager: com.android.server.pm.PackageManagerException: Creating application package ... failed
PackageManager:        at com.android.server.pm.PackageManagerService.scanPackageDirtyLI(PackageManagerService.java:10630)

Main cause seems the exception in PackageManagerService :

    pkgSetting = mSettings.getPackageLPw(...);
    if (pkgSetting == null) {
        throw new PackageManagerException(INSTALL_FAILED_INSUFFICIENT_STORAGE,
                "Creating application package " + pkg.packageName + " failed");
    }

For a not-installed user application without shared user, used code in Settings is :

private PackageSetting getPackageLPw(...) {
    // Assign new user id
    p.appId = newUserIdLPw(p);
    if (p.appId < 0) {
        PackageManagerService.reportSettingsProblem(Log.WARN,
                "Package " + name + " could not be assigned a valid uid");
        return null;
    }
}
// Returns -1 if we could not find an available UserId to assign
private int newUserIdLPw(Object obj) {
    // None left?
    if (N > (Process.LAST_APPLICATION_UID-Process.FIRST_APPLICATION_UID)) {
        return -1;
    }
}

private void removeUserIdLPw(int uid) {
    if (uid >= Process.FIRST_APPLICATION_UID) {
        final int N = mUserIds.size();
        final int index = uid - Process.FIRST_APPLICATION_UID;
        if (index < N) mUserIds.set(index, null);
    } ...
}

So there is some problem with removeUserIdLPw logic or uninstall not calling it to free app user id, which needs some detailed uninstall logs I don't have at the moment.

McX
  • 1,166
  • 1
  • 11
  • 15
0

On galaxy device :

In my case I found that Storage->Miscellaneous files-> CasheData is occupied with 8GB, consuming the entire internal memory. Empty the folder and free the memory.

After rebooting the device, applications installed without any error

BlackPearl
  • 31
  • 3
0

my problem was that i set the app location to external SD card via shell on adb after which my sd card died. even though it was no longer mounted and per the Settings screen, the default location was the internal card, my app wouldn't install. i had to reset the default location via shell to get it to work. see my answer at Android: Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE.

Community
  • 1
  • 1
mahesh
  • 227
  • 2
  • 8
0

When I got this error attempting to Install to the SD card did not work for me and I use an htc phone, but deleting some apps form the phone worked. I think the phone needs some amount of space on the internal memory and this amount of space may vary from phone to phone.

Unoye
  • 21
  • 4
0

I am using Cordova for my Android and iPhone development. After 4 months of development this error has come up about 10 different times.

WHAT WORKED FOR ME

*#9900# - METHOD #1 At first, all I had to do was...

  1. Hand-dial *#9900#; then choose to delete DUMPSTATE. But after a few weeks of doing it on occasion, I still got the error.
  2. Clear the RAM...
    • LONG PRESS THE HOME BUTTON
    • click the RAM bttn _ PRESS Clear Memory bttn at bottom
  3. Uninstall my app. NOW NO MORE ERROR. YAY!!!

But today, Method #1 above did not work. So I...

METHOD #2 - DELETE DATA IN DOWNLOADS

  1. I deleted everything in the Downloads folder, and... NOW NO MORE ERROR. YAY!!!

Thanks and hope this helps!

0

maybe this could help you...

  1. check setting > storage > check Preffered install location*

*if Removable SD Card. please change it to Internal device storage. because, maybe your SD Card have problem.

hope it helps

Jetwiz
  • 363
  • 2
  • 12
-3

This problem is because your device doesn't have more space for install the application.