Tuesday, October 25, 2011

How to solve Must Override a Superclass Method Error

Ever import some Android sample code into eclipse and get the dreaded  "Must Override a Superclass Method Error"?
In this blog post I am going to explain the source of the problem and how to fix it.

You might receive an error like this:
The method onClick(View) of type new View.OnClickListener(){} must override a superclass method Java Problem





The Source of the Problem: The project was written with a Java JDK Compiler compliance level of 1.6 but your eclipse setting is 1.5.

How to fix the problem: 


Right click on your project and select "properties"
Select "Java Compiler" 
Make sure "Enable project specific settings" is checked
Change the "Compiler compliance level:" to 1.6
Save the changes. 
Now select "Project" > "Clean..." 
Your project should now build without any errors.

Please feel free to post comments or questions. I usually post a reply within a day or two.

21 comments:

Anonymous said...

thanks a lot for this post, saved me some time.

Anonymous said...

Great thanks.

Nick said...

Thank you!

Anonymous said...

Thank you so much, you saved my life!

IamStalker said...

Hi what is the style of your eclipse and how can i get it?

Greg Zimmers said...

I created it. I also am sharing it. Here is my blog post about my dark color theme and a link to download the import file.

http://androidcodemonkey.blogspot.com/2011/04/eclipse-dark-color-theme.html

Anonymous said...

Excellent help

Anonymous said...

I LOVE YOU

madsravn said...

Thank you! Have been looking all over for this. Was kinda hard to find :)

Anonymous said...

Excellent
Thank you

Anonymous said...

Nice thank you....

Anonymous said...

Thank you. This helped me out tremendously.

Anonymous said...

This is very helpful! Thanks! :D

cz said...

This saved my ass. Thanx a lot.

Anonymous said...

Thanks a lot. Saved a lot of time. :-)

TimothyOnline dotnet said...

Kicked my errors out the front door. Thanks, buddy!

Sagar said...

Hello,
Thanks a lot, Its working for me.

Anonymous said...

Thank you!!! You have saved one more soul today...

Anonymous said...

saved me a bunch of frustration! Thanks!

Anonymous said...

Thanx!

Anonymous said...

Super.......

Post a Comment