I wanted to know if there was a size limit to the data files an android app can use or a size limit depending on the SD card (or internal memory) filesystem ?
Cheers
Olivier
The file size limit is determined by the filesystem. FAT32, for instance, cannot handle files larger than 4GB. Unfortunately, it is fairly likely that your microSD card is formatted in FAT32.
For Android 2.2 and older, the internal file system is YAFFS. The author, Charles Manning, states in this mailing that the maximum file size is 512 MB. It has been announced that Android 2.3 will use ext4.
It might be possible to format your SD card to this format as well, but I haven't tried it. Bear in mind that you won't be able to read the contents under Windows or OS X.
See also the answers in this topic.
Related
I am looking for a best practice for considering internal vs. external storage depending on file size.
The docs give no size reference for internal storage getFilesDir(), but 1MB for getCacheDir():
You should always maintain
the cache files yourself and stay within a reasonable limit of space
consumed, such as 1MB.
Let's say an app needs to temporarily store video files, that are internal to the application. Assume 20 video files with 5MB each means 100MB total.
Is it reliable that the app can store 100MB in internal storage with getFilesDir()?
The Android 9 Compatibility Definition says:
Handheld device implementations:
[7.6.1/H-0-1] MUST have at least 4 GB of non-volatile storage
available for application private data (a.k.a. "/data" partition).
I believe this means that getFilesDir() is required to be at least 4 GB.
For Android 4.3:
Device implementations MUST have at least 512MB of non-volatile
storage available for user data. That is, the /data partition MUST be
at least 512MB.
Each Android version has a different amount of required storage space per app. If you are interested in the details, check out the other ACDs.
I'm developing an app that will download large files (mostly videos). What I need to know is this:
Is there a max singe file size imposed by either Android or iOS? All I've seen is the 4GB limit of a FAT filesystem. The max video size should come no where near that, but we want to be 100% sure that there isn't a lower limit
Is there a max amount of space allocated to a single app on either system? Google turned up nothing on this question, so I am going to assume there isn't a limit beyond available file space (which seems logical, but also far to free for an Apple-built system)
Is there a max number of individual files or directories for either system? Again, Google turned up nothing. I don't see why there would be here, but I want to cover all the bases here.
Thanks!
All answers here are for Android:
Is there a max singe file size imposed by either Android or iOS? All I've seen is the 4GB limit of a FAT filesystem.
I would not exceed 4GB.
Is there a max amount of space allocated to a single app on either system?
No, there is no per-app quota system at this time. That being said, try not to make users regret using your app. :-)
Is there a max number of individual files or directories for either system?
Yes, but since the counts should be in the millions, your app will grind to a halt long before you hit those limits.
Can't answer for iOS, but for Android, your APK can't exceed 50MB (if it does, you can include expansion files for your additional data).
Here is the link to the docs explaining all the details:
http://developer.android.com/guide/google/play/expansion-files.html
I've looked around and have noticed that the max size for an apk is 50MB, but I am curious as to how much application space an app can download. Can one app take up all of the application storage or does it need to download additional content into the internal storage and/or sd card?
Thanks
The APK limit has been increased from 50MB to 4GB (see http://androidcommunity.com/android-market-upgrading-app-size-limit-to-4gb-20110511/ ), so one would presume that an app could store up to 4GB.
That said, you should be storing any large files on SD card (or similar) instead of taking up the app space (some phones this is shared space, such as the Galaxy Nexus.) Doing it that way won't have any limits except the space available on the SD card from my understanding.
i have a weird thing when downloading file from an URL in my program.
I perform check of available updates of files on server by checking same file's size on the device and on the server. When i use getContentLength method of URLConnection class i get one size, then i download and check the downloaded size by bytes which get downloaded and get same size. But when i look at the size of the files on the SDCard they are about 1.4 times bigger. Why does this happen?
So, basically i download one size and get different on SDCard and thats why i can't check if they are updated by asking the server.
URL is of https type, files are .ics
It's possible that it's due to filesystem overhead. I assume you're writing to a FAT32 SD card, in which case there may be significant overhead in some cases.
According to Wikipedia (http://en.wikipedia.org/wiki/File_Allocation_Table):
"Note however, that files are allocated in units of clusters, so if a 1 kB file resides in a 32 kB cluster, 31 kB are wasted."
Consider trying with large files or files of different sizes if possible, and see if the ratio of expected to actual size remains the same.
Solved. The problem was with the encoding. I had to use OutputStreamWriter with secon parameter "UTF8". And that aswell solved the problem with cyrylic letters in the text.
My app needs to save files that will range from about 2-20mb. When I tried to do this I was getting an OutOfMemoryException. I did some reading and it's looking like Android has a file size limit of 1mb. Is this correct? If so, is there a way around this limitation, other than splitting up every file into 1mb chunks?
The main application need to be small, like < 1 MB but you can save as many files as you want and as large as you want as long as you save them on the memory card. The available space that can be used for applications (and other secure data) is limited, usually under 128 MB. So basically you need to keep your application small and put the large part as an add-on or extra files that can be put on the memory card. If you application will use 20MB from the available space it will drastically reduce the number of people that will use it.
OutOfMemoryError means you exceeded the VM's RAM budget, which is 16MB or 24MB depending on what device you're on. It has nothing to do with file sizes.
The 1MB limit you're probably referring to is the maximum size of a compressed asset in an APK file.
Files in your app-private data area or on external storage can be as large as the filesystem will allow them to be. (I've heard the FAT32 implementation Android uses for SD cards has a 2GB limit for individual files, but don't remember the resolution of that thread.) Available disk space will likely be a larger concern.
Going back to your original problem, check the logcat output (via adb logcat or DDMS) to see if there are any messages from the garbage collector right before the OOM fired.