Home » Android » Storage limit in raw and asset folder in android

Storage limit in raw and asset folder in android

Posted by: admin June 15, 2020 Leave a comment

Questions:

I want to store some video/audio files in raw folder of my application.

I don’t know the storage limit of raw and asset folder.

Can anybody tell me how much data i can store in raw and asset folder.

And also what if i store bulk data in those folder, does it will affect to speed of execution or size of application to download from market?

Thanks in advance.

How to&Answers:

There is no limits on any resources now after Android2.3 release the new aapt.The limitation is caused by the older aapt for system peformance reason and should not happen now.

Answer:

According to The reason for Assets and Raw Resources in Android:

The main differences between the raw folder and the Assets folder.

  • Since raw is a subfolder of Resources (res), Android will automatically generate an ID for any file located inside it. This
    ID is then stored an the R class that will act as a reference to
    a file, meaning it can be easily accessed from other Android classes
    and methods and even in Android XML files. Using the automatically
    generated ID is the fastest way to have access to a file in Android.

  • The Assets folder is an “appendix” directory. The R class does not generate IDs for the files placed there, so its less
    compatible with some Android classes and methods. Also, it’s much
    slower to access a file inside it, since you will need to get a
    handle to it based on a String
    . There is also a 1MB size limit
    for files placed there
    , however some operations are more easily
    done by placing files in this folder, like copying a database file
    to the system’s memory. There’s no (easy) way to create an Android
    XML reference to files inside the Assets folder.

The limit on any resource that will be compressed by apk is 1MB, either in the raw directory or under assets. This is because it is compressed by apk at build time, and relies on phone hardware resources on the handset to uncompress it. A limit of 1MB is imposed so that a handset can uncompress it, even with limited resource.

Check out more in the HERE the use of the raw folder about its size and many more.
Also check the Android apps file size limit blog HERE

Answer:

Ahead there is so many problems while you are loading the large size of files Directly from assets folder or raw folder.Some times it possible to cause vm budget out of error in android.

For solving your problem Place your resources in a server. Load them while very first installation of your application and store them in sd card .And access them into your application from your sd card…