9

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)

Fugogugo
  • 4,460
  • 10
  • 36
  • 50
  • Could you provide the logcat detail? You can get it from the adb tool, Eclipse in Debug view or with the "aLogCat" app available in the Market. – miguelv Mar 24 '11 at 11:40
  • 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) – Fugogugo Mar 24 '11 at 11:48
  • Is this on the emulator? – Robby Pond Mar 24 '11 at 11:55
  • 3
    Are you able to try mounting a clean SD card? Otherwise you can try to delete the 'smdl2tmp1.asec' file. – miguelv Mar 24 '11 at 12:01
  • 1
    rightly. deleting that file finish my problem. :) – Fugogugo Mar 25 '11 at 16:08
  • I had this problem and setting android:intallLocation="auto" solved it. I never was able to find smdl2tmp1.asec to delete it. – charles young Jul 28 '12 at 06:34

5 Answers5

6

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

Anand Sainath
  • 1,807
  • 3
  • 22
  • 48
  • 4
    Worth 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. – stealthcopter May 23 '11 at 22:28
  • To compile it, you should set your target to >=8 and may leave minSDKversion <8 – Andrey Regentov Mar 24 '12 at 07:33
  • There are several variations on the `Failed to create container smdl2tmp1` problem, for some of them see my answer here: http://stackoverflow.com/a/30343659/313113 – Alex Bitek May 20 '15 at 08:18
2

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.

Javier Sedano
  • 923
  • 3
  • 11
  • 28
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:

http://www.androidpolice.com/2011/04/19/fixing-the-couldnt-install-on-usb-storage-or-sd-card-problem-on-android/

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.

1

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.

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Mohamed
  • 761
  • 9
  • 19
0

Rebooting the device worked for me.

Geltrude
  • 1,093
  • 3
  • 17
  • 35