Error when set android:installLocation="preferExternal"
Solution 1
Check what your minSDKversion is set to. This feature is available only from FROYO. (SDK VERSION 8 onwards).
Also you need to compile this and run on Android2.2 sdk
Solution 2
It appears Android is a little buggy in this respect, and does not handle all possible cases correctly.
I had a similar, but more complicated problem. The solution is basically to delete the appropriate file in /sdcard/.android_secure/... See also:
My own problem involved two android devices. One app was installed on device#1 (Android 2.2), then I mounted device#1 onto device#2 (an Android 4.0.3). Then I installed the same app on device#2. Guess what, it installed onto the SD card of device#1, overwriting the install on device#1. The app did not work on device#2 after unmounting device#1. The app did still work on device#1. I uninstalled it on device#2, no errors, but could not re-install it (I got the error "Failed to create secure container smdl2tmp1").
My solution was to uninstall the app on device#1, then re-mount it onto device#2, then installing it on device#2 worked. Then I moved the app from SD card to internal memory.
Solution 3
In my case, the file smdl2tmp1.asec was somehow corrupted. I put the card on the PC and I was not even able to copy that file into my harddisk (for backup). So I had to delete it, and it solved the problem.
Yesterday my phone rebooted while installing a game, and I think it has somehitng to do with this problem.
Solution 4
May I suggest that you check and see if you have an external SD card mounted from your emulator? You can set it when you create your AVD.
Related videos on Youtube
Fugogugo
Updated on June 04, 2022Comments
-
Fugogugo over 1 year
when I set the Manifest.xml file like this
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.fugo.Rocket" android:versionCode="1" android:versionName="1.0" android:installLocation="preferExternal">
the android installation will get error
[2011-03-24 18:18:47 - Rocket Project] Installation error: INSTALL_FAILED_CONTAINER_ERROR [2011-03-24 18:18:47 - Rocket Project] Please check logcat output for more details. [2011-03-24 18:18:47 - Rocket Project] Launch canceled!
but when I set android:intallLocation="auto"
the installation is success. why is that?
logcat Error
03-24 18:48:38.784: ERROR/PackageHelper(1284): Failed to create secure container smdl2tmp1 03-24 18:48:38.784: ERROR/DefContainer(1284): Failed to create container smdl2tmp1 03-24 18:48:38.784: ERROR/Vold(86): ASEC file '/mnt/secure/asec/smdl2tmp1.asec' currently exists - destroy it first! (Address already in use)
-
miguelv almost 13 yearsAre you able to try mounting a clean SD card? Otherwise you can try to delete the 'smdl2tmp1.asec' file.
-
Fugogugorightly. deleting that file finish my problem. :)
-
-
stealthcopter over 12 yearsWorth noting that while the feature is only avaliable from SDK level 8 onwards, it will still run on lower versions and simply ignore the XML.
-
Andrey Regentov almost 12 yearsTo compile it, you should set your target to >=8 and may leave minSDKversion <8
-
Alex Bitek over 8 yearsThere are several variations on the
Failed to create container smdl2tmp1
problem, for some of them see my answer here: stackoverflow.com/a/30343659/313113