Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I can't use Override annotations at Android?

I'm developing an app to android but I can't use the Override annotations. It keeps saying that the method must override a superclass method, which does. I'm using Java 1.7 and Android API 8 (2.2). Using Eclipse.

Any ideas?

EDIT:

Example

@Override
public int getCount() {
    // TODO Auto-generated method stub
    return this.data.size();
}

But the compiler don't let me use @Override, saying its not a superclass method. I'm exetending BaseAdapter.

like image 831
Comic Sans MS Lover Avatar asked Jan 18 '23 05:01

Comic Sans MS Lover


1 Answers

You should be using java 1.6 when building android projects. Java 1.7 isn't compatible with the current set of Android tools. Change your projects to use 1.6 and this problem should go away

In eclipse: Right click project -> properties -> Java Compiler -> switch all references to 1.7 to 1.6

like image 188
dymmeh Avatar answered Jan 25 '23 23:01

dymmeh