全新的应用程序在R.java中抛出“语法错误,插入”}“来完成ClassBody”

时间:2022-05-15 15:41:53

I just created a new project in Eclipse and R.java is showing "Syntax error, insert "}" to complete ClassBody" on the very last semi-colon.

我刚刚在Eclipse中创建了一个新项目,而R.java在最后一个分号上显示“语法错误,插入”}“以完成ClassBody”。

I'm double checked all my XML files for errors and missteps and misspellings and empty arguments to no avail.

我仔细检查了所有我的XML文件是否有错误,错误和拼写错误以及空洞的参数无济于事。

Here's the last few lines of code in R.java that's throwing the error.

这是R.java中抛出错误的最后几行代码。

            public static final int View_android_focusable = 0;
    /**
      <p>
      @attr description
       Sets the padding, in pixels, of the end edge; see {@link android.R.attr#padding}. 


      <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
    Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
 "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
      <p>This is a private symbol.
      @attr name com.example.reignofgodsplayer:paddingEnd
    */
    public static final int View_paddingEnd = 2;
    /**
      <p>
      @attr description
       Sets the padding, in pixels, of the start edge; see {@link android.R.attr#padding}. 


      <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp     (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
 theme attribute (in the form
 "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
 containing a value of this type.
      <p>This is a private symbol.
      @attr name com.example.reignofgodsplayer:paddingStart
    */
    public static final int View_paddingStart = 1;
};

2 个解决方案

#1


I meet the same problem like you when I change "target=android-20" to "target=android-23" in the project.properties file. if I recover it . there is no problem. so you need to try to modify "target=android-20" project.properties file,maybe is a good way.

当我在project.properties文件中将“target = android-20”更改为“target = android-23”时,我遇到了和你一样的问题。如果我恢复它没有问题。所以你需要尝试修改“target = android-20”project.properties文件,也许是一个好方法。

#2


Go to gen > android.v7.appcompat package, then copy R.java and replace it with the existing R.java in the default package.

转到gen> android.v7.appcompat包,然后复制R.java并将其替换为默认包中的现有R.java。

#1


I meet the same problem like you when I change "target=android-20" to "target=android-23" in the project.properties file. if I recover it . there is no problem. so you need to try to modify "target=android-20" project.properties file,maybe is a good way.

当我在project.properties文件中将“target = android-20”更改为“target = android-23”时,我遇到了和你一样的问题。如果我恢复它没有问题。所以你需要尝试修改“target = android-20”project.properties文件,也许是一个好方法。

#2


Go to gen > android.v7.appcompat package, then copy R.java and replace it with the existing R.java in the default package.

转到gen> android.v7.appcompat包,然后复制R.java并将其替换为默认包中的现有R.java。