views:

550

answers:

4
+1  A: 

I don't work on Android, but the Javac compiler can be told to use an older version of the Java platform:

javac -source 1.4 -target 1.4

Hopefully that will at least get you in the right direction.

davecom
+2  A: 

You must use Java 1.5 to compile Android.

Romain Guy
A: 

I faced the same problem. The issue is that android code is not compatible properly with java 1.6, so the default biild abords if the java version is >1.5 . Unfortunately, all java computers are usually updated to 1.6 version of java automatically.

So, for compiling Android you will need to remove the 1.6 version and install the 1.5 version of java.

uninstalling is straighforward. just use your system tools for rpm management to remove.

installing 1.5 is a bit of a bother. add an older repository to the sources list, and install the sun-java5-sdk from it.

Hope this helps. Sorry I cant give exact steps as I do not have a centOS system on hand, but I have compiled it on an Ubuntu system.

Alternatively, you can change the build system and fix the java errors :)

Vibhu
A: 

There's some difference in code between 1.5 and 1.6...

Exactly, 1.5 uses @ Anotations like these -> @Override, @Deprecated, @SuppressWarnings. Maybe Android developers loved these... But maybe Java platform developers hated it.(I think)

Sometimes error message occurs like this. You are attempting to build with the incorrect version of java.

=================================================== Your version is: java version "1.5.0.19".

The correct version is: 1.6. Please follow the machine setup instructions at

http://source.android.com/download

But this message is wrong itself.

In your case, error message is adequate. Change java6 to java-1.5.0 as an alternative. search the solution. That should be an enough answer...

eastsky