1

After eclipse update couple days ago, I start getting funny errors, like this:

package a.b.c;

import android.app.ListActivity;
import android.os.Bundle;

public class MyActivity extends ListActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
}

Description Resource    Path    Location    Type
Syntax error on token "}", delete this token    MyActivity.java /src/a/b/c  line 11 Android Lint Problem
Syntax error on token "}", delete this token    MyActivity.java /src/a/b/c  line 11 Android Lint Problem
Syntax error, insert "}" to complete ClassBody  MyActivity.java /src/a/b/c  line 10 Android Lint Problem

Sometimes closing/repopening project helps.

Sometimes closing/repopening eclipse helps.

I got so tired of these errors.

What is the right way to fix it.

If always happens when eclipse start messing up with CR/LF in *.java file.

I set Eclipse preferences from Windows->Preferences. Navigate to General -> Workspace and then for the "New text file line delimiter" to Other "Windows" but it doesn't help.

Still getting same error.

Same old guy...
  • 305
  • 1
  • 3
  • 15

2 Answers2

0

I would try starting Eclipse with the -clean option on the command line. I would bet that Eclipse is storing information in an old format, and the updated plugin doesn't like it.

Zagrev
  • 2,000
  • 11
  • 8
  • Just tried - same errors exactly. Anyway to pinpoint, which plugin causing it? Want to add I work with eclipse for 2 years only, never seen anything like this before... – Same old guy... Jul 10 '12 at 20:31
  • It's the parser/validator for the editor window. I would expect it to be the java editor window, but maybe it's not. That's something you can check easily by right-clicking on the file in the project view and selecting "Open with...". The first item should be the default editor for that file/type. It could have been overridden by a plugin you added for Android development? – Zagrev Jul 11 '12 at 14:59
  • First item in Open with... is Java editor. Again, when the error happens, the .java file has all (or some) CR+LF replaced by CR only (unix style) No idea why does it start happening, didn’t happen for few days already... – Same old guy... Jul 15 '12 at 01:51
0

There is obviously a bug in Android Lint. It will sometimes take over errors from the Java tools (as you can see in your problems views "Type" column). To get rid of the wrong errors, just press the "remove all warnings" button in the "Lint warnings" view.

When running Lint again the next time, you will get the valid errors/warnings back.

Bananeweizen
  • 21,797
  • 8
  • 68
  • 88
  • Sorry, can reproduce the problem for few days already. Got another error tho, described here: [link]( http://stackoverflow.com/questions/7870265/unable-to-execute-dex-multiple-dex-files-define-lcom-myapp-rarray) All suggested solutions look more like shaman dancing, but worked! Nobody can explain, why does it happen, tho ;-) – Same old guy... Jul 15 '12 at 01:47