Search code examples
javaandroideclipser.java-file

Eclipse R.java changes not saved


When I "quick fix"an error like "gcm_unregistered cannot be resolved or is not a field" and click "Create constant gcm_unregistered in type String" there is a add in R.java ->

public static final class string {

    public static final int gcm_unregistered = 0;

After saving that the project rebuild and creates a new standard R. java without the added line. I have seen examples with more lines in R.java so something in my project is going wrong or I missed a setting?


Solution

  • I'm not sure what gcm_unregistered is supposed to be but I recommend Not editing the R class because its generated. If you'd like to add something to the Resources (R) do it through the xml. Heres Android's Site for manipulating/accessing resources http://developer.android.com/guide/topics/resources/accessing-resources.html

    EDIT: So you want to add a string resource then go to the strings.xml under res/values/ and add gcm_unregistered with the value you want.