Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems importing an Android project into Eclipse

I reinstalled my computer and tried now to import my Android project into the workspace. (File -> Import -> General -> Existing Project into Workspace)

But now I have got a strange error.

    bNormal.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            gotoNextQuestion();
        }
    });

In the second line (@Override) eclipse always tells me there is an error:

/* Multiple markers at this line
- implements android.view.View.OnClickListener.onClick
- The method onClick(View) of type new View.OnClickListener(){} must override a superclass Method */

This happens everywhere, where @Override is used. I already tried to Android-Tools -> Fix Project Settings and Project -> Clean.

I hope somebody can help me with this strange problem.

Thanks, Mark

like image 766
Mark Avatar asked Nov 02 '10 09:11

Mark


People also ask

Why import option is not working in Eclipse?

Try this: Go to Preferences » Java » Editor » Content Assist » Advanced. Make sure Other Java Proposals is ticked/checked. If that does not work simply close the project and reopen it.


1 Answers

It is because the language level is set to 5.0. Change it to 6, and all will work fine. Don't know where to set it eclipse, but in Idea it's File - Project Structure - Project Language level

It happens because OnClickListener is an interface and in 5th Java @Override can not be applied to a method implementation.

like image 107
Vladimir Ivanov Avatar answered Sep 22 '22 00:09

Vladimir Ivanov