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/W
To be able to build, I created a file ant.properties
in the facebook project (first project that is compiled) with the contents :
java.compilerargs=-Xlint:-options
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.
This is set in the ${sdk.dir}/tools/ant/build.xml
file. At the beginning of the file are many property
settings, e.g.
<!-- compilation options -->
<property name="java.encoding" value="UTF-8" />
<property name="java.target" value="1.5" />
<property name="java.source" value="1.5" />
<property name="java.compilerargs" value="" />
<property name="java.compiler.classpath" value="" />
Also at the beginning of this file is a comment
At the beginning of the file is a list of properties that can be overridden by adding them to your ant.properties (properties are immutable, so their first definition sticks and is never changed).
So, in order to override any property in general and source value and target value in particular, you can put these properties into the ant.properties file in your project directory
java.source=1.6
java.target=1.6
This overrides the default settings in ${sdk.dir}/tools/ant/build.xml
and thus prevents the warnings.