Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 311
jul Avatar asked May 10 '11 11:05

jul


3 Answers

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

like image 190
Dan Dyer Avatar answered Sep 18 '22 22:09

Dan Dyer


Worth noting that: "File-based resource names must contain only lowercase a-z, 0-9, or underscore" characters. (quoted from compile error code).

like image 24
Safa Alai Avatar answered Sep 22 '22 22:09

Safa Alai


The number is not allowed as first char of resource also not any capital letter

like image 38
Dharmendra Avatar answered Sep 19 '22 22:09

Dharmendra