Titanium Studio Compile Error R.java ';' expected public static final int

iKnow-IT banner

After compile the Titanium mobile project on Android platform I've got the following error:

[ERROR] Error(s) compiling generated Java code
[ERROR] .../Titanium Studio Workspace/.../R.java:40: ';' expected public static final int E-mail=0x7f04005d;
                                 ^

.../Titanium Studio Workspace/.../R.java:40: <identifier> expected public static final int E-mail=0x7f04005d;
                                      ^

I use i18n for translation, and that caused in this case this error

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    ..
   <string name="E-mail">E-Mail adresse</string>
</resources>

 

and my source code like:

var email = reseller[0].reseller[L('E-mail')];

 

The solution:

Replace the entry in string.xml like:
<string name="E_mail">E-Mail adresse</string>

And replace the source code like:
var email = reseller[0].reseller[L('E_mail')];

 

Also you cannot use string names that start with digits in your i18n files and I found that spaces in string names don't work, either