What's the difference between the RES and assets folder on Android

I wonder if assets and res are the same on Android, is that sometimes I find examples that reference resources in assets and others in res, it's messing me up a bit.

 5
Author: Webserveis, 2016-04-14

2 answers

These would be the most notable differences between /res and /assets:

/assets

  • inside this folder are added files that when the package is generated .apk retain its name and features.
  • you can add files with caps or signs which is not allowed within /res.
  • within this folder you can even create a file structure.

Example:

assets
 |__Directorio
 |__miBasedeDato
 |__ArchivosAndroid
  • the R class does not generate ids for the items stored in this folder
  • an important difference is that within /assets are added elements which can be read as a stream of bytes.

/res

  • contains application resources such as layouts, drawables, strings, etc.
  • the main difference from /assets is that these resources are accessed through the R class, which is automatically generated by the project and contains ids that they reference each resource within /res.
  • another difference is that within /res, only files with names containing lowercase characters from "a" to "z" and numeric characters from 0 to 9 are allowed.
 7
Author: Jorgesys, 2020-06-11 10:54:57

From experience, in Res go all the Android resources that you can make use of or create them yourself, for example, animations, styles, extra layouts, etc.already in the folder assets would go all the extra resources that you can use and that are not from Android, for example fonts and multimedia files. In my case, there I have placed videos, ogg files, fonts, etc. up to even html and css files.

enter the description of the image here

 2
Author: x4mp73r, 2016-04-14 19:03:06