In my strings.xml file I have
<string name="continue">Continue</string>
I can’t build my project because of the error: “Invalid symbol: ‘continue'”. Why I can’t use such a name?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s because
continueis a reserved symbol in Java, so you cannot use it as a name for any object in your XML files or Java code.The reason this is a problem is that the XML defined in your project is translated into Java code that the Dalvik VM can understand. So, your code above translates into the following in R.java:
The problem is more obvious when examining the (would-be) generated code.
See list of reserved Java symbols for others to avoid.