2

I'm having trouble with the size of my application when trying to run on the emulator. I'm using images that take, for now, 11MB of space. First, when starting the emulator, it takes almost a minute to upload the file, then this error is shown:

[2011-10-24 11:29:50 - MyApp] Failed to install MyApp.apk on device 'emulator-5554': No space left on device
[2011-10-24 11:29:50 - MyApp] com.android.ddmlib.SyncException: No space left on device
[2011-10-24 11:29:50 - MyApp] Launch canceled!

When I'm looking into my folder, the whole folder of the app takes 37MB. The biggest one is the /bin-folder. There are the two files MyApp.apk (12MB) and resources.ap_(12 MB) and, one step down in the bin/packagename/-folder, there are 85 files, named like my StartActivity, numerated from Start$1.class up to Start$85.class. In my Start.java is the HomeScreen, where some images are shown, but many many onClickListeners with Intents.

Is that normal or could this be the reason?

Before, I've got some other errors, like the INSTALL_FAILED_MEDIA_UNAVAILABLE error and INSTALL_FAILED_INSUFFICIENT_STORAGE. Since then, I've found some threads on stackoverflow.com and I've done some changes in the emulator-settings, like adding in the commandline:

emulator.exe -avd 2TabGalaxy3.2GoogleAPI -partition-size 16384 -no-snapshot-load

(16384 is ok? cause 1024mb wouldn't be enough size)

I've also checked "Wipe User Data" and edited the AVD:

SD Card Size: 256MB
SD Card support : yes
Max VM application heap size: 192
Device Ram Size: 192

But I'm always getting the same types of errors, which say that there isn't enough space. Anyone knows a solution?

I've read that the maximum size of the apk-file is 50MB. That's right?

Lukas Knuth
  • 25,449
  • 15
  • 83
  • 111
10ff
  • 813
  • 4
  • 16
  • 31
  • Could you post the exact error message? – Michell Bak Oct 24 '11 at 10:53
  • What exactly do you mean? That was the whole error printed in the console. Before this, there stood [2011-10-24 13:17:12 - BrunnerApp] ------------------------------ [2011-10-24 13:17:12 - MyApp] Android Launch! [2011-10-24 13:17:12 - MyApp] adb is running normally. [2011-10-24 13:17:12 - MyApp] Performing my.name.MyApp.Start activity launch [2011-10-24 13:17:12 - MyApp] Automatic Target Mode: Preferred AVD '2TabGalaxy3.2GoogleAPI' is available on emulator 'emulator-5554' [2011-10-24 13:17:12 - MyApp] Uploading MyApp.apk onto device 'emulator-5554' – 10ff Oct 24 '11 at 11:17
  • 1
    Sorry, must have missed it. Perhaps this question and answer can help you: http://stackoverflow.com/questions/3536463/android-application-apk-maximum-size – Michell Bak Oct 24 '11 at 11:21
  • Ok, thanks. It becomes clear, that the maximum size will be 50MB. Tried the preferExternal entry in the Manifest already, but that didn't help. Why is there such a large difference between maximum iphone Apps (2GB) and Android Apps (50MB)? – 10ff Oct 24 '11 at 12:37
  • 1
    Because Android rules ;-) Seriously though, there's no reason why you'd need that large an application file. You can just download images, sounds, etc. separately. That also makes updating the application a lot easier. – Michell Bak Oct 24 '11 at 12:46
  • Ok, that's a good reason.. but just if your internet is available at the time. But I think for the most apps this can be ignored. Thanks for the help! At least, a combination of your tip and Ivan's helped me. – 10ff Oct 25 '11 at 10:41

2 Answers2

1

I think that probably you runned out of space on your emulator.

In my emulator i have ~35mb of free space.

I'm not sure if that help (but it could be a try:

You can try to update you manifest file adding android:installLocation="preferExternal" in the manifest tag like in this EXAMPLE:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="org.yourappname"
      android:versionCode="1"
      android:versionName="1.0" android:installLocation="preferExternal">

In that way if available your application should be isntalled in the external SD Card.

Or you can try to follow this post: http://androidforums.com/desire-tips-tricks/160560-force-apps-install-sd-without-root.html it explains how to force android to install all packages on External SD (it is more a workaround).

Ivan
  • 4,186
  • 5
  • 39
  • 72
  • yes, you're right, the emulator's space is too low... that's also what is shown in the emulator at the right bottom: "low on space" before the error is shown. I've tried that change in the manifest, but unfortunately it didn't help. – 10ff Oct 24 '11 at 11:10
  • Hm, as it seems is my app already installed on the sd card. At least it's shown in the emulator in the menu Application Settings -> Applications. But there it says, that the app would be just 52KB big. And that 14MB of the SD card are used, 238MB free. In my Manifest, there stands android:installLocation="preferExternal" and in the Edit-Window of the AVD I've given the SD Card 256MB of space. Mysteriously that it's still saying: no space left on device? – 10ff Oct 24 '11 at 11:53
  • I tried that solution and I am now in the tools-folder. when I'm writing "adb devices" in the command line, then he says, that this command is unknown. Maybe there's something missing in my sdk-installation? – 10ff Oct 24 '11 at 12:08
  • 1
    First of all try to manually remove the app in the emulator and then reinstall it. Then if you look into tools folder there is a file called adb has moved! Now you find it in platform-tools/adb instead of tools/adb. – Ivan Oct 24 '11 at 12:16
  • Ok, thanks. That was right. Then I've entered "adb devices", which still worked, but when typing in "adb shell", he refused, that the command couldn't be found. Sorry for my noobie questions, but I didn't have to work with the command line until now. – 10ff Oct 24 '11 at 12:30
  • The error is Device not found? When you launch adb commands the Emulator must be turned on. And with adb devices command you receive a list of android devices found, this list must contain at least one device: emulator-5554. – Ivan Oct 24 '11 at 12:35
  • I just had to restart Eclipse, for some reason. Then I was able to do the commands, thanks. At least, I created a new emulator, with the properties I've posted in my answer. – 10ff Oct 26 '11 at 16:23
0

So, at least I can't say what exactly has been the mistake, but a combination of Ivan's and Michell Bak's tips helped me.

I deleted the old emulators and created a new one, where I entered 32 MB for the size of the SD card, added in the device configurations in the command line

-partition-size 2047

and added this in the Android Manifest:

android:installLocation="preferExternal"

Now the errors are gone. Thank you very much!

10ff
  • 813
  • 4
  • 16
  • 31