Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: rebuild now requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Why remove of @Override? [duplicate]

Tags:

java

android

Possible Duplicate:
Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties

After rebuilding my PC I get this error on importing my projects.

Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.

I have seen this raised on SO and I can fix my projects by doing the Fix Proj, and then removing all my @OVerrides.

this question is why do I now require to remove @Overrides? and will this alter my projects in anyway?

cheers

Edit to add walkthrough information.

I import a project, I get the error shown above. I then do the Android Tools > Fix Project Properties. This now sets Project>Properties Java Compile to Compiler Compliance Level 1.5

After this I am left with a series of errors within my java files. on this particular project my errors are on

@Override 
public void run() {... 

Error marker to left of error read...

Multiple markers at this line
    - The method run() of type new Runnable(){} must override a superclass 
     method
    - implements java.lang.Runnable.run

the error hover in eclipse suggests I remove the @Override to fix this issue, and if I do remove the @Override it does fix the issue and my project now compiles and runs. Is this incorrect?

p.s. I just wrote all that up, changed the Java Compliance level to 1.6 and all the override errors went away! Could someone explain (and I totally appreciate this might be totally off topic) why?

like image 378
Purplemonkey Avatar asked Apr 15 '12 13:04

Purplemonkey


2 Answers

Dont remove any @overide notation.

you must set project compatibility to Java 5.0 or Java 6.0.

To do that, 2 options:

1) right-click on your project and select "Android Tools -> Fix Project Properties" (if this din't work, try second option)

2) right-click on your project and select "Properties -> Java Compiler", check "Enable project specific settings" and select 1.5 or 1.6 from "Compiler compliance settings" select box.

refer this LINK for reference

like image 57
Shankar Agarwal Avatar answered Sep 28 '22 09:09

Shankar Agarwal


FIRST UPDATE EVERYTHING....

Now right click on your project and select "Android Tools" then "Add Support library" it will update then try the stuff i copied from above....

1) right-click on your project and select "Android Tools -> Fix Project Properties" (if this din't work, try second option)

2) right-click on your project and select "Properties -> Java Compiler", check "Enable project specific settings" and select 1.5 or 1.6 from "Compiler compliance settings" select box.

Big Thanks to Agarwal Shankar for the start...

like image 36
Roger Large Avatar answered Sep 28 '22 07:09

Roger Large