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.

66 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.......

afnan khan said...

A lat of thanks

Anonymous said...

Great! Thanks a lot. Saved a lot of time

Anonymous said...

Thanks a lot!!!

Anonymous said...

Thanks! Helped a lot :)

Anonymous said...

thanks a lot

freedownloadcore said...

amazing. thanks. it works now :)

chris said...

This helped me greatly!

Anonymous said...

Great Job man ...
Helped me a lot :)

Anonymous said...

thanks!-angeles jesus

John Paul Manoza said...

If you set the Compiler to 1.6.and still you get this error. Try to check your imports. Eclipse always try to do this 'import android.content.DialogInterface.OnClickListener' instead of the doing this -> 'import android.view.View.OnClickListener'. That solves my problem.

Unknown said...

Thanks - had this exact problem - love the quick fix

Anonymous said...

Amazingly helpful thank you

Anonymous said...

Thanks much !!!

Anonymous said...

Thanks Greg.

Anonymous said...

THAAAAANNNNKKKKSSSS!!!!!!!!!!!!!!!!

Anonymous said...

Thanks a lot! :)

Anonymous said...

Thank's mate!
That saved my laptop from a rather violent punch.

John Coogan said...

Thanks a ton! Saved me a ton of time!

Unknown said...

thanks for the post

Anonymous said...

Thank you. Thank you very much.

Anonymous said...

Thanks a lot!

Anonymous said...

Sorry to be negative but this didn't work for me. Still getting told to remove @Override. Any other suggestions ?

Anonymous said...

Just found the solution on another site. After setting Compliance Level to 1.6 and BEFORE running Clean, it is essential to uncheck Project > Build Automatically.

Anonymous said...

Awesome Solution...

Kennedy Mwenda said...

Great

Anonymous said...

Gracias!
Thanks!

Anonymous said...

Thanks for this nice post. Saved me a lot of time.

Ranjeet Shukla said...

thanks for help

Chang bui thi said...

This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something
Signature:
i like play games friv online and play games2girls Download baixar facebook

Frozen Juegos said...

I am happy to find this post very useful for me
Signature:
Jugar juegos de frozen en línea gratis, los nuevos de princesa de Disney juegos frozen - la princesa encantadora y linda. Divertirse frozen!

Facebook Descargar said...

Thanks for sharing the information. It is very useful for my future. keep sharing
Signature:
download descargar facebook gratis para Android celular and download free descargar facebook apk en español, descargar facebook plus , descarga facebook

Whatsapp Descargar said...

Great post,Thanks for providing us this great knowledge,Keep it up.
A good blog.
Signature:
download free descargar whatsapp plus gratis and download whatsapp baixar online and descargar whatsapp , baixar whatsapp gratis

pubsquash John said...

Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write
Kizi 123
Friv 234
Friv
Kizi 2
Kizi 1

bibikafu said...

Hello to every body, it's my first pay a quick visit of this weblog; this weblog carries amazing and really excellent data in favor of readers.
Friv 4
Kizi 3

Yepi said...

You need to kill time, you need entertainment. Refer to our website. hope you get the most comfort.
Thanks you for sharing!
Yepi
Kizi
Friv
Friv Games

Muhammad Amiruddien said...

Salam...

Saya nak tumpang promosi website...

http://eload.ml

http://bit.ly/17lBrz5

Terima kasih...

Online Friv said...

you'd have time to look these kids active. Please visit our website and let us play the game interesting.
Thanks for sharing !
Friv 10
Kizi 10
Yepi 2

tranbaongoc said...

You are stressed and tired, you need entertainment. Refer to our website. hope you get the most comfortable.
Kizi 4

Br Agario said...

I would like more information about this, because it is very nice., Thanks for sharing.
happy wheels , agario , happywheels , agar ,

Watergirl Fireboy said...

I would like to thank you for the efforts you have made in writing this article.I would like to thank you for the efforts you have made in writing this article.
fireboy and watergirl | super smash flash 2 , fireboy watergirl | ssf2

Le Bens said...

Thanks for the best blog.it was very useful for me.keep sharing such ideas in the future as well.this was actually what i was looking for,and i am glad to came here!
Friv 100

Friv5 said...

You need to kill time, you need entertainment. Refer to our website. hope you get the most comfort.
Thanks for sharing !
Friv 5
Kizi 1
Yepi 3

Anonymous said...

thank you for your interest in welcome visit
Friv 4

Anonymous said...

New attractive game . I will play it every day
Friv|
Friv 2

Friv4 said...

When you're tired, you want to relax after a stressful working hours, you need to have time to take care of the kids active.
Please visit our website and play exciting flash games.
Thanks you for sharing!
Friv 4

Post a Comment