Eclipse R.java更改未保存(Eclipse R.java changes not saved)

编程入门 行业动态 更新时间:2024-10-21 11:37:38
Eclipse R.java更改未保存(Eclipse R.java changes not saved)

当我“快速修复”诸如“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.

更多推荐

本文发布于:2023-07-04 11:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1023564.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Eclipse   java   saved

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!