当我在AndroidManifest.xml文件中指定preferExternal时,我无法将应用程序安装到虚拟设备(API 10和17)。
控制台输出:
[2013-06-11 12:01:51 - MyApp] Android Launch!
[2013-06-11 12:01:51 - MyApp] adb is running normally.
[2013-06-11 12:01:51 - MyApp] Performing com.mydomain.MyApp.activities.ChannelActivity activity launch
[2013-06-11 12:01:51 - MyApp] Automatic Target Mode: Preferred AVD 'NexusS_API17' is available on emulator 'emulator-5554'
[2013-06-11 12:01:51 - MyApp] Uploading MyApp.apk onto device 'emulator-5554'
[2013-06-11 12:01:55 - MyApp] Installing MyApp.apk...
[2013-06-11 12:01:59 - MyApp] Installation error: INSTALL_FAILED_CONTAINER_ERROR
[2013-06-11 12:01:59 - MyApp] Please check logcat output for more details.
[2013-06-11 12:01:59 - MyApp] Launch canceled!
LogCat输出:
06-11 10:01:57.385: W/ActivityManager(302): No content provider found for permission revoke: file:///data/local/tmp/MyApp.apk
06-11 10:01:57.755: I//system/bin/make_ext4fs(32): Creating filesystem with parameters:
06-11 10:01:57.755: I//system/bin/make_ext4fs(32): Size: 2158592
06-11 10:01:57.755: I//system/bin/make_ext4fs(32): Block size: 4096
06-11 10:01:57.755: I//system/bin/make_ext4fs(32): Blocks per group: 32768
06-11 10:01:57.755: I//system/bin/make_ext4fs(32): Inodes per group: 144
06-11 10:01:57.755: I//system/bin/make_ext4fs(32): Inode size: 256
06-11 10:01:57.766: I//system/bin/make_ext4fs(32): Journal blocks: 0
06-11 10:01:57.775: I//system/bin/make_ext4fs(32): Label:
06-11 10:01:57.775: I//system/bin/make_ext4fs(32): Blocks: 527
06-11 10:01:57.775: I//system/bin/make_ext4fs(32): Block groups: 1
06-11 10:01:57.785: I//system/bin/make_ext4fs(32): Reserved block group size: 7
06-11 10:01:57.795: I//system/bin/make_ext4fs(32): Created filesystem with 11/144 inodes and 23/527 blocks
06-11 10:01:57.846: I/Vold(32): Filesystem (ext4) formatted OK
06-11 10:01:57.855: E/Vold(32): ASEC FAT mount failed (No such device)
06-11 10:01:57.926: E/PackageHelper(1091): Failed to create secure container smdl2tmp1
06-11 10:01:57.926: E/DefContainer(1091): Failed to create container smdl2tmp1
06-11 10:01:57.937: W/ActivityManager(302): No content provider found for permission revoke: file:///data/local/tmp/MyApp.apk
看起来人们在过去曾遇到类似smdl2tmp1的问题,但我的AVD没有smdl2tmp1.asec文件。我尝试过很多东西:
有没有人对如何让我的应用程序安装在外部SD卡上有任何建议?安装到内部存储时运行正常。
答案 0 :(得分:0)
如果您希望设备从现在开始在外部设备中安装应用程序,请使用Android SDK并检查<sdk>/tools
,<sdk>/platform-tools
文件夹位于您的路径中。打开程序并下载程序包android-tools
。
然后连接您的设备enable USB debug mode,检查防火墙是否处于活动状态,并在具有“管理员权限”的shell中执行此命令:
adb shell pm set-install-location 2
如果显示错误消息:
错误:多个设备和模拟器
这是因为您有多个设备(您的真实手机和其他虚拟设备,众所周知的AVD)。您可以使用此命令检查其中的手机是什么。
adb devices
我将展示这样的内容:
在我的情况下,它是两个活动设备:一个是模拟器(AVD),正如其名称所示,另一个是我的手机“99000200835402”。如果您在我的情况下喜欢两个具有相同ID的设备,只需使用TaskManager终止进程“adb.exe”,重新连接手机并再次检查,它应该只是具有不带“emulator-”前缀的id的设备。因此,执行以下命令:
adb -s“99000200835402”shell pm set-install-location 2
但是使用您的手机ID代替 99000200835402 ,它应该如下所示:
有关更多信息,请访问以下链接: