当我“快速修复”诸如“gcm_unregistered无法解析或不是字段”之类的错误并单击“在字符串类型中创建常量gcm_unregistered”时,在R.java中添加了一个 - >
public static final class string {
public static final int gcm_unregistered = 0;保存后,项目重建并创建一个没有添加行的新标准R. java。 我在R.java中看过更多行的例子,所以我项目中的某些内容出错或者我错过了一个设置?
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?
最满意答案
我不确定gcm_unregistered应该是什么,但我建议不要编辑R类,因为它生成了。 如果您想在Resources(R)中添加一些内容,请通过xml完成。 用于操纵/访问资源的Android网站http://developer.android.com/guide/topics/resources/accessing-resources.html
编辑:所以你想添加一个字符串资源,然后转到res / values /下的strings.xml,并添加gcm_unregistered和你想要的值。
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.
更多推荐
发布评论