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
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.
Your android SDK is probably not in the same path. Fix that in your eclipse settings.
精彩评论