Skip to main content
Known Participant
October 22, 2014
Question

Android assets use double the storage space due to cache?

  • October 22, 2014
  • 0 replies
  • 307 views

I'm working on a game with a very large bundle of assets. What we're finding is that after install, the device needs to have slightly more than the original APK size as available storage space to run. This appears to be due to assets being copied out of the APK to the application cache when first accessed.

What we've experienced:

     - With a lot of small separate files, our loading times are unreasonably slow (several *minutes* between scenes with ~100MB in assets).

     - If we pack up the assets into a single large (>1GB) pack file and load them ourselves out of the APK, there's a ~60-second hit the first time the pack file is accessed during the first time the app is launched.

The initial loading time happens during FileStream.open(), and appears to be from the pack file being copied to the application cache. After that, loading data is nearly instantaneous. However, that fails if the device doesn't have enough available storage for the whole pack file.

Balancing these issues, we broke the assets into several pack files that are accessed when needed. The first access of each file is reasonable (10 seconds or less), and the initial launch of the app doesn't have the long delay as the file is cached.

The problem still remains that after the game has been running for a while, the device can still run out of storage space as it fills up the cache folder, even though we broke up the assets so only a small number of the asset pack files are ever needed at once. Presumably this is also a problem with the small individual assets, just on a more granular scale.

Assuming it isn't possible to break up the APK and download the files separately, is there any way to either (a) avoid the copy of the pack file to the cache on first access and read the data directly, or (b) programmatically remove the ones that are no longer in use (either on our own or by informing Air that it's okay to remove them)?

This topic has been closed for replies.