18

I have been developing my app for around two months, in the last week i have started getting the following error when trying to compile and run the app from Eclipse:

java.io.IOException: Unable to upload file: No space left on device

The APK comes out at 3.6Mb and the emulator is a recently created fresh one with 512Mb SD card and other specs identical to the G1.

Can anyone suggest a reason this might be happening?

Tom
  • 1,191
  • 1
  • 13
  • 24
  • I'd pop open `adb shell` and run `df` to see which partition is running low on memory. Then post the output here (edit your original question). – Roman Nurik Feb 25 '10 at 09:14
  • If you're targeting 2.2 you can use preferExternal in your manifest to have it save most of your application to the SD card to keep the memory usage down. – stealthcopter Oct 18 '10 at 21:50

7 Answers7

29

The apps are installed in /data/apps. Make sure that your data partition size is big enough to support your app. The command for running the emulator will be

emulator.exe -avd <AvdName> -partition-size 512 -no-snapshot-load

Partition size will set size of system and data images in MB. You can change 512 to a greater value depending on your needs. -no-snapshot-load ensures that you are not booting from a snapshot and thus you see the new partition size.

Mudit Jain
  • 4,163
  • 1
  • 22
  • 18
  • 5
    The effect of this command is permanent, so you don't need to run it every time – Noel Oct 15 '11 at 17:42
  • If you are having trouble with 'No space Left' and you are sure that you aren't using all of the space on the device (i.e. <50MB apk and >100MB SDCard/etc.), then this is the command you need to run. – steve-gregory Feb 08 '12 at 21:34
  • what about push using adb (system files) `https://medium.com/@dai_shi/installing-google-play-services-on-an-android-studio-emulator-fffceb2c28a1` also `-partition-size` is invalid command (`emulator` says) – user25 Jun 10 '18 at 08:19
9

I've had that happen before, and I solved it by creating a new virtual device as Mr. Hedlund suggests. I didn't spend time trying to figure out why it happened, but creating the new device allowed my app to upload. My application is nearly twice as big as yours, and it uploads fine most of the time. Try deleting and re-creating the emulator as Mr. Hedlund suggests. It's worked for me on several occasions... Being new at Android development, I'm suspicious that I've been running into that issue due to resource leaks, but I haven't chased the problem down yet because I'm still concentrating on getting my app to work correctly... Hope this helps!

jeffgzx9
  • 269
  • 1
  • 6
  • Thanks, recreating the device fixed the issue and it hasn't occurred again. – Tom Mar 29 '10 at 10:04
  • It's not a good solution. It is similar to advice to factory reset your tablet or phone each time this kind of the problem occurs! – ol_v_er Feb 22 '12 at 10:00
5

wipe data from avd manager. it will fix the problem. for visual assistance you can follow http://wikistack.com/no-space-left-on-device-android-studio/

Jay Bhaskar
  • 157
  • 2
  • 11
2

This happens because, you dont have free space in the drive where you are creating your Emulator, try deleting few items of that drive and it would get launched, make sure you have 1 gb (for precautions) data free in the drive. It worked for me

Ali Ashraf
  • 1,841
  • 2
  • 24
  • 27
1

Applications are not stored on the SD card, so that should not be a part of the equation. I've never seen a device fill upp like that, but just create a new virtual device, I guess...?

David Hedlund
  • 128,221
  • 31
  • 203
  • 222
1

I encountered this issue as well. After recreating the AVD multiple times and still encountering the failure, I double-checked the size of the .apk. It had ballooned to 46MB because I accidentally included a set of camera images in the 'assets' folder. After removing those, the size dropped to <1MB. Make sure to double (and triple) check that you only have the files you need in the directory structure.

Jason Shah
  • 2,595
  • 3
  • 23
  • 25
  • 1
    My apk is 64mb. So, I set the heap size to 100mb. It didn't help. I'm still looking for a solution. – Mike S. Jan 04 '13 at 16:03
0

Setting the partition size, as indicated by Mudit Jain, fixed the problem of loading a 42MB apk for me as well. Setting the partition size is also discussed here.

Community
  • 1
  • 1