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.

62 comments:

Anonymous said...

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

Anonymous said...

Great thanks.

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?

Unknown 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

Aliyah 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

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

Ken Programmer said...

Great

Anonymous said...

Gracias!
Thanks!

Anonymous said...

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

Unknown said...

thanks for help

Unknown 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

Luong Cong Huynh 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

Unknown 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

Anonymous said...

thank you for your interest in welcome visit
Friv 4

Unknown said...

This blog explains the details of most popular technological details. This helps to learn about what are all the different method is there. And the working methods all of that are explained here. Informative blog.
Hadoop Training in Chennai

Suseela said...


This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.

Online Reputation Management

شركة زهرة العلا said...

شركة زهرة العلا للخرمات المنزلية بالسعودية واحدة من افضل الشركات التي تعمل بالمجال يرجع كل هذا الي الثقة والسرعة والدقة وجودة الخدمة التي تقدم للعميل ولافضل الاسعار الممكنة مع الحفاظ علي الجودة ونوعية المبيدات ومواد النظافة واثرها علي البيئة وصحة الاسرة كما ان الموارد البشرية الخاصة بنا علي اعلي دراية وفهم بالامور وذو خبرات طويلة في مكافحة الحشرات,النظافة العامة مثل الفلل,الشقق,الواجهات الزجاجية والحجرية,البلاط والرخام,الحدائق,المسابح وغيرها من امور النظافة كما انهم يجيدون التعامل مع كافة الاثاث الخشبي والزجاجي وغيرها والقيام باعمال النقل والفك والتركيب والتغليف بواسطة النجارين المحترفين كما يوجد لدينا افخك مستودعات تخزين الاثاث بالرياض والمتميز بالصفات القياسية للحفاظ علي العفش من الاتربة والرطوبة وغيرها من الامور التي تؤدي الي التلف فقط للحصول علي الخدمات المنفردة اتصل بنا علي الارقام الموضحة بالموقع ليصلك مندوبنا للمعاينة المجانية واعطاء النصائح والارشادات شركات النظافة بالدمام
شركات النظافة بالطائف
شركة تنظيف خزانات بابها
افضل شركة تنظيف مسابح بالدمام
افضل شركة تنظيف بالرياض
افضل شركة تنظيف فلل بالرياض
شركة رش مبيدات حشرية بالدمام
شركة مكافحة حشرات بالاحساء
شركه مكافحة حشرات بالطائف
شركة مكافحة النمل الابيض بحائل
شركة مكافحة حشرات بخميس مشيط
شركة مكافحة الارضة بالدمام

obat setelah operasi caesar said...

I am really empowered with your writing talent. Anyway keep up the wonderful high
quality writing, it’s rare to see a great blog
such as this these days

Unknown said...

I’m really impressed with your writing skills and also
with the layout on your weblog. Is thiss a paid
theme or did you modify it yourself? Anyway keep up the nice quality writing, it’s rarfe to
see a nice blog like this one nowadays.
obat penyakit kusta basah
obat herbal sinusitis dan polip
obat jamur mulut untuk anak

Sawan said...

Expanding Menu View in Android:
This is a library to help creating expanding views with animation in Android.
http://bit.ly/expanding-menu-view-in-android

smarther3 said...

This blog is having the general information. Got a creative work and this is very different one.We have to develop our creativity mind.This blog helps for this. Thank you for this blog. This is very interesting and useful. android Training in Chennai

Navya Kumar said...

Usually I do not read post on blogs, but I would like to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Great work admin.Keep update more blog.
Web Development Company in India

Unknown said...

Its very useful to me. pianotiles2.com

alicetaylor said...

I am very happy to read this. Appreciate your sharing

god is greater than the highs and lows

Post a Comment

Note: Only a member of this blog may post a comment.