Several weeks ago I took a snapshot of my Android project by simply copying the entire folder (Windows 7) to a network share.
A few weeks later, I wanted to build that snapshot in a new (and different) workspace. So I:
I was then surprised to find errors in the project - errors that weren't there before I copied it over to the network share.
The first symptom was that only the last file in the project had multiple errors. I "fixed" that by entering into Eclipse (again!) Android's SDK location:
Windows > Preferences > Android > SDK Location: C:\android-sdk-windows
This resulted in numerous files now having errors, with the following hint at the console:
Android requires .class compatibility set to 5.0. Please fix project properties.
I fixed that by hovering over @override
and selecting the Change workspace compliance and JRE to 1.5
balloon suggestion. This is strange because I checked Windows > Preferences > Java > Compiler > Compiler compliance level:
and it was 1.6 before - Doesn't 1.6 include 1.5?
I was then left with only two errors stemming from @Override
s that shouldn't really be there (for methods implementing interface). So I removed them and now all is fine and the project builds and runs perfectly as before.
All nice and dandy but I was very surprised by the fact that I actually had to change anything in Eclipse, not to mention that I eventually ended up modifying the original source code (deleting @override
s only) to get it build - source code that had no complaints whatsoever weeks ago!
What could possibly explain this? Isn't copying an Android project folder a true full backup?
Being baffled by this discovery, I examined the workspace folder, using my beloved Emacs, and discovered that there is a hidden subdirectory named .metadata
. This is probably where the secret lies.
My questions now are:
.metadata/.log
file? Can I safely
delete it?I had those errors too when imported a project. If I'm remembering correctly, helped right-clicking in project name and selecting Android Tools -> Fix project properties...
After that errors disappeared.
“Android requires .class compatibility set to 5.0. Please fix project properties.” What’s this? It’s the error I received after cloning a repository and trying to import it into Eclipse. There is reasonably little information online about this, couple discussions on mailing lists but I figured I would write a post on the solution to this.
After importing the project to your workspace, you’ve received the error. So what you need to do next is to right click on the project -> Android Tools -> Fix Project Properties. Now this alone won’t fix the problem, you need to restart Eclipse after this. After that try building the project again and it should work successfully this time (unless you have bugs in the code itself, I did).