9

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?
Jonas
  • 121,568
  • 97
  • 310
  • 388
Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
  • i have uploaded image of emulator for the "Memory related issue" if any – Paresh Mayani Aug 27 '10 at 13:39
  • Please help me...i am in the search of solution of this issue since last 2 weeks..so please – Paresh Mayani Aug 28 '10 at 06:25
  • Come on, you've been here a while; please learn to format your questions better! No doubt it will help you get more attention and answers. –  Aug 31 '10 at 11:44
  • 1
    Why do the images need to be kept in the "drawable" folder? Even if they're on the SD card, you can access them just the same. You won't get your automatic "R" links but there are ways to pull a drawable from a file instead. – Drew Sep 03 '10 at 07:30
  • @Drew sorry for late reply , was on holiday but then how can i give images with application whoever download the application – Paresh Mayani Sep 06 '10 at 04:44
  • I think 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. Not a perfect solution but it seems to be your only one. I'll add this as an answer instead of just a comment. – Drew Sep 06 '10 at 05:29
  • @Drew thats gr8 idea but having no idea for that...i need to load up images one-by-one based on the user touch on the screen – Paresh Mayani Sep 06 '10 at 05:48
  • That's possible regardless of whether the images are in the drawable folder, on the SD card or streamed from the net. Unfortunately, due to the huge number of images, you'll have to go with one of the latter two options: SD card or streaming. – Drew Sep 06 '10 at 06:14
  • @Drew but according to me...streaming is not the feasible solution because it takes lots of time to load images as per my application – Paresh Mayani Sep 06 '10 at 06:25
  • In that case, your best bet is to download everything the first time your application is run and then access the images from your SD card. – Drew Sep 06 '10 at 13:36
  • For a production applications, downloading to SD card is probably the correct answer. But since you asked on another thread about increasing the emulator size, I wanted to be sure you saw my answer there: http://stackoverflow.com/questions/2239330/how-to-increase-storage-for-android-emulator-install-failed-insufficient-storag/3945915#3945915 – SomeCallMeTim Oct 15 '10 at 20:39

6 Answers6

10

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..

Milan
  • 15,389
  • 20
  • 57
  • 65
  • @Milan thanx for the answer...just now i checked the "logcat" but no error is displayed at logcat – Paresh Mayani Aug 28 '10 at 09:44
  • @Milan thanx for the really great and helping information..but i have also created emulator with 2.2 , and still getting the above error – Paresh Mayani Aug 30 '10 at 06:38
  • What I explained above is how it works on 2.2 platform. That is, there is no way to install that application on a phone with that much memory. – Milan Aug 30 '10 at 09:49
  • @Milan pls read this setence that i have mentioned clearly android:installLocation="preferExternal" and this mean i want to install application in sd-card – Paresh Mayani Aug 30 '10 at 12:39
  • I'm sorry, I don't know if I can't explain this well or you are not understanding my way of explaining. With android:installLocation="preferExternal" the phone will NOT ignore the ram limitations explained in my post and Vidars blog. That means no matter what you do, currently as of august of 2010, you can't install that application on the SDcard due to android not letting you do that. – Milan Aug 30 '10 at 13:00
  • @Milan thanx milan, pls let me know regarding "August 2010" matter as you mentioned above...please – Paresh Mayani Sep 01 '10 at 05:28
9

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.

Daniel
  • 26,899
  • 12
  • 60
  • 88
5

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.

Julio Gorgé
  • 10,056
  • 2
  • 45
  • 60
  • You need enough space internally to load the .apk before it is moved to the SD card. Please increase the internal memory for the emulator. – smith324 Aug 27 '10 at 15:03
  • Gorge @Chris324 how do i increase internal memory ?? – Paresh Mayani Aug 28 '10 at 04:36
  • Gorge @Chris324 ya you people are right, but suppose if i increase the internal memory of emulator and having success to run it on emulator then what about the internal memory increment? is it possible to increment the size of internal memory of phone? – Paresh Mayani Aug 28 '10 at 05:07
3

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.

Drew
  • 2,269
  • 21
  • 16
2

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.

drbob
  • 21
  • 1
1

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

DonGru
  • 13,532
  • 8
  • 45
  • 55
  • /dev: 95764K total, 0K used, 95764K available (block size 4096) /mnt/asec: 95764K total, 0K used, 95764K available (block size 4096) /system: 77568K total, 77568K used, 0K available (block size 4096) /data: 65536K total, 21112K used, 44424K available (block size 4096) /cache: 65536K total, 1156K used, 64380K available (block size 4096) /mnt/sdcard: 258064K total, 1K used, 258062K available (block size 512) /mnt/secure/asec: 258064K total, 1K used, 258062K available (block size 512) – Paresh Mayani Aug 27 '10 at 13:35