Search code examples
androidresourcesnaming

Naming rules for Android resources


where can I find the naming rules for Android resources? I found out thanks to compilation errors that I must use characters within [a-z0-9._], but I also have an error with an image named 401.png. When using it in my layout using

@drawable/401

I get the following compilation error:

invalid VariableDeclaratorId

I can't find these rules in the doc, and I'd like to know all of them before naming my files.

Thanks


Solution

  • The rules are the same as for Java identifiers since each resource must have a corresponding ID field generated in the R.java file.