Someone Somewhere Someone Somewhere - 1 month ago 28
Android Question

source value 1.5 is obsolete and will be removed in a future release

How do I prevent the two warnings below from generating an error that stops the build process ?

-compile:
[javac] Compiling 77 source files to /Users/andev/Workspace/android/products/myproject/1.0/Facebook/bin/classes
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] error: warnings found and -Werror specified
[javac] 1 error
[javac] 3 warnings

Answer

Another possibility (which will fix it for all Android builds made with Ant), is to tweak the default parameters for the -compile task in <android-sdk>\tools\ant\build.xml.

At the <!-- compilation options --> section, you can either set the compiler flags:

<property name="java.compilerargs" value="-Xlint:-options" />

or, alternatively, change the source and target parameters:

<property name="java.target" value="1.6" />
<property name="java.source" value="1.6" />

As of now, 1.6 is enough to avoid the warning.

Comments