What does this mean: Failure [INSTALL_FAILED_CONTAINER_ERROR]?
Solution 1
Change the install location from
android:installLocation="preferExternal"
into
android:installLocation="auto"
in your project's AndroidManifest.xml.
Solution 2
If you're using an emulator, edit it and add more memory. I've had a problem just like this one and all I did was edit my AVD's memory from 200 MB to 1000 MB and the problem seem to go away... Good Luck.
Solution 3
This means there was an earlier installation that was corrupt. If you install on external I would suggest that you format the sd card an try again.
Solution 4
I have had this error repeatedly. I have found the simplest way to avoid the error in its entirety is to simply format the SD card. Using the phone or emulators internal tools. I have found that the automatically generated SD cards or even making your own sdcard.iso fails and causes this error unless formated by the internal android tools.
Solution 5
For me this was caused by a lack of space on my emulator's SD card. I was working with a pretty large project and I had thought 40 mb was enough, but I changed it to 200 mb and the problem went away.
Mathias Conradt
Cybersecurity Professional (CIAM, AppSec, DevSecOps, OSINT), Software Engineer, Open Source Enthusiast, Privacy Advocate, Tactical & Stealth Gamer, Motor Biker.
Updated on June 18, 2021Comments
-
Mathias Conradt about 3 years
I try to deploy my app and sometimes get this error:
Failure [INSTALL_FAILED_CONTAINER_ERROR]
I tried to google it but don't find what the error means or what it's caused by. I deploy via IDE (IntelliJ) the file gets copied to the device to the /data/local/tmp (unrooted Huawei Ideos, running 2.2), but the package manager doesn't seem to like it. Before installing the apk, I already removed the app from the device beforehand. I also made sure there was no old file under /data/local/tmp on the device. Still I'm getting this error now. The package should be signed with the debug key, since I deploy via IDE by 'running' the app.
$ pwd /data/local/tmp $ ls -l -rw-rw-rw- shell shell 17257686 2011-04-21 20:31 com.company.shop $ pm install -r com.company.shop pkg: com.company.shop Failure [INSTALL_FAILED_CONTAINER_ERROR]
What does it mean and how to resolve it?
Edit/Update:
I can avoid the error when not allowing the app to be installed on sdcard, setting
android:installLocation="internalOnly"
in the manifest. It's ok for development, but for production, it's not really what I want - since my app is quite large with 17mb; therefore I prefer it to be on sdcard. How to ever be able to install it on the external memory without rooting (since this is the only way I could delete /mnt/secure/asec/smdl2tmp1.asec, which seems to be one solution as well).
-
Joel almost 12 yearsThis is what did it for me. Thanks!
-
Senthil Kumaran over 11 yearsYes, this did it for me too. Thanks!
-
Aiden Fry over 11 yearsbut i want to preferExternal...? How to fix this?
-
Tofeeq Ahmad over 11 years@AidenFry this is problem of eumlator problem. So change until you test on eumlator
-
Aiden Fry over 11 years@Sameer nope, this occurs on real devices too - but is inconsistent. Main ones are HTC Desire S and Nexus devices.
-
Rizwan Sohaib over 11 yearsyeah, it happened with me on HTC Desire S, and fixed by changing install location to auto. Thanks..
-
Andrew Barber about 11 yearsWelcome to Stack Overflow! Thanks for your post! Please do not use signatures/taglines in your posts. Your user box counts as your signature, and you can use your profile to post any information about yourself you like. FAQ on signatures/taglines
-
James Green about 11 yearsThis doesn't really help the OP with their problem, since their concern is getting it working on real world devices, plenty of which still use ARM CPUs.
-
L. G. over 10 yearsResolved this with the same solution, as the problem is cause by an error writing to the SDCard, it is better than the workaorund of Rene f you want to keep android:installLocation="preferExternal".
-
L. G. over 10 years@AidenFry Use user2445968 solution if you want to keep preferExternal.
-
djdance almost 10 yearsConfirm. Error on SD was the reason for me. I tested it removing "prefer external" from manifest - its installed ok.
-
NaXir over 9 yearsYea it happened same with me. Thumbs up :)
-
Alex over 9 yearsFor those who, like me, didn't have sources of the application, follow the instructions of this site : miui-au.com/add-ons/apktool . apktool provide a very handful feature, decoding, modifying files, and recoding apk's.
-
Ayyappa over 9 yearsThis should be the answer!
-
Varun over 9 yearsIn addition to increasing the memory I also had to wipe user data and only after that, the new size reflected and the error went away.
-
Sam about 9 yearsThis seemed to be the solution for me running Cyanogenmod 12 (Android 5.0.2). That open seemed to be forcing the app to install on the removable SD card even though the app's manifest specified that it couldn't be installed there.
-
Jonny almost 9 yearsMay I guess that you refer to Internal Storage, and not RAM?
-
Meet Vora over 6 yearsI increased my AVD's memory, and then wiped data!! and now it's working.