10

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.

erdemlal
  • 491
  • 5
  • 21
Mahaveer Muttha
  • 1,727
  • 4
  • 21
  • 33
  • 5
    Each file in asset or raw needs to be under 1MB before compression. The total size of the APK can not exceed 50MB; if it does, you will need an expansion apk. – 323go Feb 21 '13 at 06:17
  • @323go: okk so i can add data in raw folder till then my apk size is below 50 MB. is it? – Mahaveer Muttha Feb 21 '13 at 06:20
  • You can. It might be a better idea to load rich content separately, however. Makes for faster installs and updates. – 323go Feb 21 '13 at 06:22

3 Answers3

14

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.

futurexiong
  • 408
  • 4
  • 13
11

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

Community
  • 1
  • 1
GrIsHu
  • 29,068
  • 10
  • 64
  • 102
2

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...

Prudhvi Reddy
  • 81
  • 1
  • 8