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 …