“includeAntRuntime”没有为android蚂蚁脚本设置?

时间:2011-01-27 19:44:15

标签: android ant sdk

“includeAntRuntime”在android ant脚本中没有设置为false,每次构建我的应用程序时它都会给我带来恼人的警告。

[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

查看文件android-sdk的第354行 - * / 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>

似乎我不能在不直接修改该文件的情况下轻松修复它? Android团队,请修复它吗?

2 个答案:

答案 0 :(得分:14)

Android SDK的解决方法是将build.sysclasspath属性设置为"last",这将取消错误警告。

通过在项目的build.properties文件中指定属性值来执行此操作。

# 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

答案 1 :(得分:1)

这是由Ant 1.8中引入的错误引起的。只需将该名称的属性添加到javac任务,将其设置为false,并忘记它曾发生过。

即。在includeAntRuntime Ant任务中设置attribue javac。 Ant用户手册提供了以下属性描述:“attribute includeAntRuntime默认为yes,除非设置了build.sysclasspath。通常最好将此设置为false,这样脚本的行为对其所处的环境不敏感运行“。