Android:无法将应用移至SD卡

时间:2013-12-18 13:14:13

标签: android android-sdcard

我使用Eclipse向导创建了一个空应用

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.locationtest"
    android:versionCode="1"
    android:versionName="1.0"
    android:installLocation="auto"
    >
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

移动到SD卡按钮已启用,但是当我按下它时,我终于得到无法移动应用消息。

如何将应用移动到SD卡?

更新:

当我设置

android:installLocation="preferExternal"

我得到了

Installation error: INSTALL_FAILED_CONTAINER_ERROR
在Eclipse和日志中

D/AndroidRuntime( 8127): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 8127): CheckJNI is ON
D/AndroidRuntime( 8127): Calling main entry com.android.commands.pm.Pm
W/ActivityManager( 2207): No content provider found for permission revoke: file:///data/local/tmp/LocationTest.apk
D/VoldCmdListener( 2119): asec list
I/PackageHelper( 6435): Size of container 2 MB
D/VoldCmdListener( 2119): asec create smdl2tmp1 2 fat {} 10010
E/Vold    ( 2119): Error opening devmapper (No such file or directory)
E/Vold    ( 2119): ASEC device mapping failed (No such file or directory)
E/PackageHelper( 6435): Failed to create secure container smdl2tmp1
E/DefContainer( 6435): Failed to create container smdl2tmp1
W/ActivityManager( 2207): No content provider found for permission revoke: file:///data/local/tmp/LocationTest.apk
D/dalvikvm( 2207): GC_EXPLICIT freed 1131K, 38% free 15050K/24007K, paused 2ms+7ms
D/AndroidRuntime( 8127): Shutting down VM
D/dalvikvm( 8127): GC_CONCURRENT freed 123K, 82% free 467K/2560K, paused 0ms+1ms
D/dalvikvm( 8127): Debugger has detached; object registry had 1 entries
D/dalvikvm( 8127): Compiler shutdown in progress - discarding request
D/dalvikvm( 8127): Compiler shutdown in progress - discarding request
I/AndroidRuntime( 8127): NOTE: attach of thread 'Binder Thread #3' failed

更新2:

看起来这只发生在一个特定制造商的设备上。 或者这可能是因为SD卡处于某种不正确的状态(不知道会出现什么问题)。

2 个答案:

答案 0 :(得分:0)

使用android:installLocation="preferExternal"代替android:installLocation="auto"

请参阅此链接http://developer.android.com/guide/topics/manifest/manifest-element.html#install

如果上面没有帮助尝试这个,

从您的设备中删除此文件

/mnt/secure/asec/smdl2tmp1.asec

如果您没有root访问权限,则需要安装SD卡并通过pc将其删除:

/.android_secure/smdl2tmp1.asec

参考:

SO

答案 1 :(得分:0)

有些应用程序无法移动..

请在此处阅读:Install location

相关问题