11

"includeAntRuntime" was not set to false in the android ant script, and it gives me the annoying warning every time I build my app.

[javac] /Users/dwang/Library/android/android-sdk-mac_x86/tools/ant/main_rules.xml:361: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

Look at the line 354 of file android-sdk-*/tools/ant/main_rules.xml

            <javac encoding="${java.encoding}"
                    source="${java.source}" target="${java.target}"
                    debug="true" extdirs=""
                    destdir="${out.classes.absolute.dir}"
                    bootclasspathref="android.target.classpath"
                    verbose="${verbose}"
                    classpath="${extensible.classpath}"
                    classpathref="jar.libs.ref">
                <src path="${source.absolute.dir}" />
                <src path="${gen.absolute.dir}" />
                <src refid="project.libraries.src" />
                <classpath>
                    <fileset dir="${extensible.libs.classpath}" includes="*.jar" />
                </classpath>
            </javac>

And it seems I can not easily fix it without modifying that file directly? Android team, please fix it maybe?

dongshengcn
  • 6,434
  • 7
  • 35
  • 44
  • http://www.enterra-inc.com/techzone/using_ant_android_applications_building/ may be helpful –  Jan 13 '12 at 03:30

2 Answers2

14

A workaround for the Android SDK is to set the build.sysclasspath property to "last" and that will suppress the false warning.

Do this by assigning the property value in the project's build.properties file.

# You can use this to override default values such as
#  'source.dir' for the location of your java source folder and
#  'out.dir' for the location of your output folder.
out.dir=build
gen.dir=build/gen

# Suppress the javac task warnings about "includeAntRuntime"
build.sysclasspath=last
ohhorob
  • 11,695
  • 7
  • 41
  • 50
  • Is build.properties also called ant.properties? – Sam Wilson Nov 17 '11 at 07:23
  • I haven't found build.properties and after i creating this file, this warning is still printed. But adding it to project.properties will solve this problem. Can i configure my SDK to make this code automatically add to project.properties when i create android project ? – Frank Cheng Feb 09 '12 at 06:16
1

That's caused by a misfeature introduced in Ant 1.8. Just add an attribute of that name to the javac task, set it to false, and forget it ever happened.

ie. set the attribue includeAntRuntime in your javac Ant task. The Ant User Manual gives the following attribute description: "attribute includeAntRuntime defaults to yes, unless build.sysclasspath is set. It is usually best to set this to false so the script's behavior is not sensitive to the environment in which it is run".

Tanmay Mandal
  • 39,873
  • 12
  • 51
  • 48
  • Thanks for the comment. Actually that is easy fix, but not for the Android SDK. The target is defined in android sdk script. – dongshengcn Jan 28 '11 at 16:55