Android: ‘Must Override a Superclass Method’ Errors

I’ve been working by myself on all of my Android projects and just recently I need ed to expand my workforce to beyond that just myself. Therefore I needed to make my first hire for my company Agilevent. In doing so I needed to get my code over to another developers machine and I ran into all kinds of problems.

Background

The code is stored on GitHub in a private repository and the new developer had access. They had recently set up Eclipse and the ADT with Java 1.6. Everything was working golden. We could create a new project and everything worked fine. Except … when we tried to import the recently cloned GitHub project.

After importing Eclipse would report “Must Override a Superslass Method” on all kinds of methods all over the place (literally 86 different places in this one app).

Resolution

After a ton of futzing around we found the problem. Eclipse was defaulting to Java 1.5 for the imported project. I’m learning more and more and more about Java and its idiosyncrasies every day. In Java 1.5 classes can only be decorated with @Override when overriding a superclass method. In Java 1.6 if you have classes implementing interface methods you can decorate them with @Override and everything’s golden. You cant do that in 1.5. AKA: The source of the errors.

So where to change it?

Choose Window –> Preferences –> Java –> Compiler and ensure 1.6 is selected in the Compiler Compliance Level. If that is set and you still have problems, then in the same window, choose “Configure Project Specific Settings …”, choose the project in the chooser, and enable the project specific settings checkbox and select 1.6 in the Compiler Compliance level.

Fun times. Now if I could only get those two hours back …

Android Dev Digest

Get the best Android Developer posts delivered weekly to your inbox.

Don't worry, I wont spam (I hate that stuff too).

Book 15 Minutes

  • http://www.moncler-down-jackets.com moncler jackets

    Thank you very much for sharing!!To top!louis vuitton outlet is a professional webside which offer lots of common sense of life and I have learnt a lot since my friends recommended it to me.There are several articles about this theme in Louis vuitton bags,come on and have a discussion! air jordan 7

  • Anil

    Thank you so much. Exactly the info that I was looking for. I spent couple of hours myself but am glad found your post. Worked like a charm.

  • http://blog.donnfelker.com Donn Felker

    No problem, I'm glad it helped!

    Sent from Android

  • http://www.angelfish-it.co.uk Mark

    Thanks, it was the Configure Project Specific Settings …” . Why does it default to 1.5 I dont know!

  • Tarak

    Thanks a lot. Helped solved a problem which i was solving for long

  • Rien

    Thanks a lot

  • Keeshavah

    Thanks, very useful tip :-)

  • http://fullmeals.net Vijai

    Thanks you. I lost 2 hours on this useless bug

  • droider

    Thiank you very much — this has saved a lot of my time.

  • the_gord

    One thing to add. I had this same problem, but when I checked the Menu you listed it was already set to 1.6! I discovered that each project has it’s own settings also, which can be found by right-clicking on the project and going to properties.

  • Xazen

    Thats what I was searching for after adding OpenFeintAPI to my Project! Thanks a lot!

  • Gaganbenipal

    tahnk dude

  • Devasiskunal11

    great ,

    Thanks donn.

  • http://twitter.com/KovAlex Grigoriy Koval

    thanks!!!!!

  • Prinz

    Thank you! Not easy to spot for somebody new to Java .

  • Wengxurr

    [url=http://www.lvoutletest.com]louis vuitton outlet[/url] sells products which are excellent in quality and reasonable in price. All customers can easily pick up their favorite Louis Vuitton briefcase, wallets, shoes, hats, scarf, jewelry and sunglasses.[url=http://www.lvoutletest.com]louis vuitton outlet online[/url] is your smart choice when you want to get the discount Louis Vuitton accessory. You can find the exact Louis Vuitton Bags and other accessory you want at a low price that’s right for you. My dear friends, let the[url=http://www.lvoutletest.com]louis vuitton outlet online[/url] pave your way into the world of high fashion with their ultimate fashion factory.After graduating from university, my cousin came back to my hometown from USA last month. She told me that [url=http://www.lvoutletest.com]louis vuitton outlet store[/url] is very popular among her classmate.With the great diversity of styles, patterns and sizes available nowadays, finding the right pieces to highlight your personality is quite important. [url=http://www.biglouisvuittonoutlet.org]louis vuitton outlet[/url] offers exactly what you want.In my experience, most people adore [url=http://www.biglouisvuittonoutlet.org]louis vuitton outlet store[/url] or they hate it, there’s not much of an in-between. And that’s true of most lines that really go for it when it comes to having a point of view-the more personality a bag has, the wider the gulf between the lovers and the haters becomes.[url=http://www.biglouisvuittonoutlet.org]louis vuitton bags[/url] with fashion style and top quality succeed. In any occasions they are very suitable and appropriate for its precise and rich design.Consequently, we can know that there are few famous manufacturers that will meet all of the demands, especially the [url=http://www.biglouisvuittonoutlet.org]louis vuitton online[/url] factory.Attention! [url=http://www.louisvuitton-handbagsoutlet.us]louis vuitton outlet[/url] is offering new products at favorable prices for August. Brighter colors, finer looks and newer designs, all bring you a whole new summer.[url=http://www.louisvuitton-handbagsoutlet.us]louis vuitton sale[/url] sell the products which are classical design for stylish ladies. The pretty shape and bright color of the wallet is full of fashion elements to show your unusual identity.Besides,the soft leather and well-made handle give you a really unique appearance in any occasion.Different style bags from [url=http://www.louisvuitton-handbagsoutlet.us]louis vuitton outlet store[/url] are always eloquent statement outside a woman’s attitude towards life and career. Thus, women’s bag, must exchange the use of occasions, so they are not the same as showing different spatial and temporal rhythm of beauty.The Louis Vuitton shoulder bags win a lot of grace and market share. It can be said that the Louis Vuitton is a legend in history bags at [url=http://www.louisvuitton-outletshop.us]louis vuitton outlet[/url].[url=http://www.louisvuitton-outletshop.us]louis vuitton online[/url] is offering great collection of Louis Vuitton Sneakers for women in different styles and collections, which can make our dressing become more and more fashionable.My friend is dying to get a Louis Vuitton purse at [url=http://www.louisvuitton-outletshop.us]louis vuitton outlet store[/url] because all of her friends have them at work. They earn great reputation from many people.

  • http://www.coachoutletonline2011.org coach outlet online

     Lots of people carry the crossbody bags as they are strong, soft and flexible. Coach handbags on sale at the coach outlet online Store can meet your requirements.If you want to buy quality Coach products at lower prices, visiting coach outlet online can be your best decision.Coach outlet enjoys high popularity among the youth. They can also view other quality Coach products in the Coach coach outlet store online.handbags and purses of coach outlet online are beautiful, classic designs made for sophisticated customers to make an emphatic style statement.The leather Coach coach outlet store online uses for its totes is procured from the top ten percent of that produced for manufacturing, and tanned in large drums with natural treatments to produce a special look unique to Coach bags.Welcome to the coach factory outlet store and Enjoy Shopping Here! We promise all the customers to have the superior qualities and low prices.In the coach outlet online shop, a collection of high quality and hottest Coach Shoulder Bags is offered to you. They are all at the best prices you will ever find.You’ll get full refund when the items at the coach outlet store are not available in stock. High safety and prompt delivery is guaranteed.No one can deny the shopping at the coach factory outlet is satisfactory. For the low prices and good quality.coach outlet handbags You can not just save your cash but also your time inside a convenient way to obtain the exact same bags product and do not be concerned the shippment of one’s products.We have large quantity coach outlet online Store .Welcome to buy, free shipping with great discount promotion and best service for you now.Despite their age gap, coach outlet store online of Coach and Ellis have several shared interests:they both like the Midnight Riders, Jimmy Gibbs Junior and Whispering Oaks Amusement Park.Coach Handbags were made in 1941 in Manhattan, with high technology and good craftsmanship. coach outlet store is becoming more and more famous today.

  • Yangzhifang2006

    私たちは今まで、語る春トレンドのハンドバッグの明らかなように、がたくさんあります。私たちを持った コーチ アウトレットcoach バッグコーチ アウトレット、今日私はあなたに教えるのはもうひとつ傾向;花卉の模様が入っている。私たちは普段はこのコーチはコーチ バッグコーチの財布がなくて、しかし私はこのpurseblogの特徴がありす。コーチ 財布コーチ サングラスコーチ トート

  • Sdfsdf

    coach bags well designed for sale.
    coach outlet handbags high replica online.
    coach purses high quality for cheap.
    coach outlet store onsale wholesale for cheap.
    coach online wholesale online.
    juicy couture cheap online for sale.
    cheap juicy couture wholesale for cheap.
    discount juicy couture fashion designed for sale.
    discount juicy handbags high quality for sale.
    cheap juicy handbags wholesale online for cheap.
    juicy handbags cheap for sale.

  • Anonymous

    Thanks man!
    Great suggestion!

  • http://www.outsource-website-development.com outsourcing web development

    This is actually my very first time i visit here. I discovered so many interesting stuff in your blog particularly it’s discussion. From the tons of comments on your posts, I suppose I am not the only one having all of the enjoyment here! keep up the great work.
    outsourcing websites | offshore web development

  • http://filsupport.com/web-design-outsource/ Web Design Outsource

    It’s been a while to since this article was posted but i’m still glad to see it.

  • Guest

    Gracias, ya me estaba volviendo loco con este error.

  • Craig

    Fantastic! This was torturing me since I upgraded my Android SDK to version 4.0. I saw these errors when importing the ApiDemos project. Now I know why.

  • Toby Muresianu

    Glad you saved me those two hours!

  • Toby Muresianu

    Glad you saved me those two hours!

  • MikeDGM

    Done all of this and still got the problem when overriding  WebView.
    Other suggestions??

  • MikeDGM

    Never mind.  I fixed it by deleting the entire Class and recreating it.

  • http://blog.donnfelker.com Donn Felker

    Are you set to Java 6?

    Sent from Android

  • Coach Factory Outlet
  • Coach Factory Outlet

    It’s good to see this information in your post

  • http://top-sunglasses.org/ Oakleys

    ZBSATSBJTCXNDRT I like it very much!

  • NeverDie

    Than you donnfelker, it’s guys like you that make this world a better place :)

  • Samuel Alves

    Thank you very much!

  • Marcus

    Thanks this is a big help.

    However I have 1.7 installed and I am getting these errors. Do I need to install 1.6 to get rid of them ?

    thanks
     

  • Vault101

    thanks very much, same problem here

  • http://www.outsource-website-design.com/ outsourcing websites

    I am really impressed with this blog .You have a great blog. I have bookmark your blog to my list of favorites.

  • Hzcxh

    thx,very nice!

  • The Wife

    Thanks. Great help.

  • Kyle Dodge

    Thanks!

  • Steve

    Thank you! 

  • Johnh10000

    Well that was easy!  What else is it going to throw at me today ;)  Cheers!  

  • chankiller

    thanks man… similar problem solved coz’ of u!

  • Jonathan

    Thanks for the help, 1 hour wasted. This helped save the other 1 hour

  • Andreas

    You saved my day !

  • balar

    thanks for saving me from countless fidgety hours.

  • domi

    Thank you very much for this!