Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when set android:installLocation="preferExternal"

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)

like image 217
Fugogugo Avatar asked Mar 24 '11 11:03

Fugogugo


3 Answers

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

like image 99
Anand Sainath Avatar answered Nov 17 '22 03:11

Anand Sainath


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.

like image 23
Javier Sedano Avatar answered Nov 17 '22 04:11

Javier Sedano


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.

like image 2
Boris van Schooten Avatar answered Nov 17 '22 03:11

Boris van Schooten