可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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
回答1:
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
回答2:
You need to do two things after which this error will be resolved.
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">
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.
Reconnect your device, clean your project and again run it on the device. The project will now run on your device.
回答3:
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.
回答4:
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
回答5:
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
回答6:
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.
回答7:
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.
回答8:
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
回答9:
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
回答10:
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.
回答11:
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.
回答12:
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...
- Hand-dial *#9900#; then choose to delete DUMPSTATE. But after a few weeks of doing it on occasion, I still got the error.
- Clear the RAM...
- LONG PRESS THE HOME BUTTON
- click the RAM bttn
_ PRESS Clear Memory bttn at bottom
- Uninstall my app.
NOW NO MORE ERROR. YAY!!!
But today, Method #1 above did not work. So I...
METHOD #2 - DELETE DATA IN DOWNLOADS
- I deleted everything in the Downloads folder, and...
NOW NO MORE ERROR. YAY!!!
Thanks and hope this helps!
回答13:
maybe this could help you...
- 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
回答14:
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.
回答15:
This problem is because your device doesn't have more space for install the application.