在 Android sdk 2.2 中的 SD 卡上安装应用程序

发布于 2024-09-16 06:12:40 字数 860 浏览 2 评论 0原文

自过去两周以来,我一直面临这个问题并寻找解决方案。

现在我已经为客户开发了一个android应用程序,其大小为54 MB,其中52 MB仅是图像/照片。

[编辑:我需要将图像保留在“drawable”文件夹中]

所以我想将其安装在 Android SDK 2.2 上的 SD 卡中,因为我已经设置了 android:installLocation="preferExternal “ 在 AndroidManifest.xml 文件中。我在创建 avd 时创建了 256MB sd-card堆大小 - 192ram 大小 - 192

但它仍然显示错误:

[2010-08-27 17:58:28 - demo_test] 无法上传 demo_test.apk 设备“emulator-5554”
[2010-08-27 17:58:28 - 演示测试] java.io.IOException:无法上传 文件:设备上没有剩余空间
[2010-08-27 17:58:28 - 演示_测试] 发射已取消!

编辑:

alt text

  1. 此内存与内部存储器或外部存储器的问题有关吗?
  2. 我必须做什么才能运行应用程序并仍然使用模拟器进行测试?
  3. 如何在 Android sdk 2.2 的 SD 卡中安装应用程序?

I am facing this problem and finding solution for this issue since last 2 weeks.

Right now i have developed an android application for the client perpose, whose size is 54 MB, from which 52 MB of only Images/Photos.

[Edit: I need to keep images in "drawable" folder ]

So i want to install it in sd-card on Android SDK 2.2 for that i have already set android:installLocation="preferExternal" in the AndroidManifest.xml file. I have created 256MB sd-card while creating an avd , heap size - 192 , ram size - 192

but it still showing me an error:

[2010-08-27 17:58:28 - demo_test]
Failed to upload demo_test.apk on
device 'emulator-5554'
[2010-08-27
17:58:28 - demo_test]
java.io.IOException: Unable to upload
file: No space left on device
[2010-08-27 17:58:28 - demo_test]
Launch canceled!

Edit:

alt text

  1. Is this memory related issue of internal memory or external memory?
  2. What i have to do to run application and still test with emulator?
  3. How do i install application in sd-card in Android sdk 2.2?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

千紇 2024-09-23 06:12:40

SD卡的大小真的是256MB吗?我有时会忘记后缀并最终得到......一些非常小的东西。

您也可以随时将大小提高到 512、256,266 等,然后再次尝试确定它是其他值。

另外,Logcat 输出也很好。

编辑: 看起来,您不能只是在 SD 卡上“安装”该应用程序,即使您有 30+G 的可用空间。即使在 2.2 中,安装也取决于手机的内存。

示例:Nexus one 具有 512mb 内部存储器。 Android 操作系统需要相机、GPU、内核等所需的 RAM,只给用户留下大约 190MB 的应用程序空间(由于已经安装了应用程序等,这个空间会更低)。

另一方面,HTC Hero 只有 288mb 内存,因此“应用程序大小的内存”非常小。

根据手机的不同,90mb 的应用程序将安装到 Nexus One 上的 SD 卡上,但由于内存限制,不会安装到 Hero 上。

您收到该错误的原因是,在 android 操作系统从 192MB 中取出所需的 ram 后,“应用程序大小 ram”不足以容纳该 50+mb 应用程序。

我以为 installLocation 会直接安装到 SD,但事实并非如此。

Vidar Vestnes 博客 证实了这一点上面我通过在他的 HTC Desire 上使用不同的应用程序大小进行测试进行了描述。

Is the sd-cards size really 256MB? I sometimes forget the suffix and end up with.. something very small.

You can also always raise the sizes to like 512, 256,266 and try again to be certain it's something else.

Also, Logcat output would be nice too.

Edit: As it seems, you cant just "install" the app on the SDcard even if you have 30+Gigabyte free on it. Installation depends also on the internal memory of the phone even in 2.2.

Example: Nexus one has 512mb internal memory. The android os takes the needed ram for the camera, gpu, kernel etc leaving a user with only around 190MB app space (which will be even lower due to apps already installed etc).

HTC Hero on the other hand has only 288mb internal memory, leaving it with a very small "app size ram".

Depending on the phone, 90mb app will install to SDcard on nexus one, but won't on Hero due to memory limitations.

The reason you are getting that error is that, after the android os takes the needed ram out of those 192MB, the "app size ram" is not enough to hold that 50+mb application.

I thought that installLocation would install directly to SD, but that is not the case.

Vidar Vestnes blog confirmed what I described above by performing a test with different app sizes on his HTC Desire..

甲如呢乙后呢 2024-09-23 06:12:40

更好的方法是将资源放在 SD 卡上自己的目录中。然后您的应用程序可以在需要时加载它们。

A better approach would be to put your resources in their own directory on the SD card. Then your app can load them when it needs.

江湖正好 2024-09-23 06:12:40

我建议您尝试增加可用内存(屏幕截图显示为 43MB),以防 .apk 在操作系统安装到 SD 卡之前先被复制到内存中。

I suggest you try increasing the internal memory available (screenshot says 43MB), in case the .apk is being copied there first before it is installed to the SD card by the OS.

星光不落少年眉 2024-09-23 06:12:40

假设您需要设备上的图像而不是云端的图像,最简单的方法是让应用程序连接到您的服务器并在首次运行时下载包含所有图像的 zip。在设备获得更大的“应用程序内存大小”之前,这可能是您唯一的解决方案。

Assuming you need the images on your device instead of on the cloud, the easiest way would be to make the app connect to a server of yours and download a zip containing all the images on its first run. Until devices get a larger "app ram size" this might be your only solution.

饮惑 2024-09-23 06:12:40

您可以使用以下命令:

adb shell pm setInstallLocation 2

从 android-sdk/tools 目录强制将模拟器安装到您的 SD 卡上,无论其大小如何——显然,最好足够大以容纳您的应用程序。

如果您想返回到默认安装位置(手机应用程序内存),请执行以下操作:

adb shell pm setInstallLocation 0

您还可以在手机/平板电脑上使用这些 adb 命令。

一旦您设置了模拟器以安装到 SD 卡上,您就可以进入“设置”-->“应用领域-->管理应用程序,选择您想要放在SD卡上的应用程序,“移至SD卡”按钮将不再显示为灰色。

You can use the following:

adb shell pm setInstallLocation 2

from the android-sdk/tools directory to force the emulator to install to your sd card, whatever its size -- preferably large enough to hold your app(s), obviously.

If you want to go back to the default installation location (phone app memory), do:

adb shell pm setInstallLocation 0

You can also use these adb commands on your phone / tablet.

Once you have set up the emulator to install to the sd card, you can then go into Settings --> Applications --> Manage Applications, choose the app you want to be on the sd card, and the "Move to SD Card" button will no longer be grayed out.

楠木可依 2024-09-23 06:12:40

运行命令检查sd卡是否真正挂载以及是否有足够的空间

adb shell df

可以通过android-sdk/tools目录下的
它显示当前安装了哪些分区、它们有多大以及有多少可用空间

you can check if the sd card is really mounted and enough space is available by the running

adb shell df

command in the android-sdk/tools directory
it shows you which partitions are currently mounted, how big they are and how much free space is available

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文