Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
&引用;includeAntRuntime“;是否未为android ant脚本设置?_Android_Ant_Sdk - Fatal编程技术网

&引用;includeAntRuntime“;是否未为android ant脚本设置?

&引用;includeAntRuntime“;是否未为android ant脚本设置?,android,ant,sdk,Android,Ant,Sdk,在android ant脚本中,“includeAntRuntime”没有设置为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

在android ant脚本中,“includeAntRuntime”没有设置为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
请看文件AndroidSDK-*/tools/ant/main_rules.xml的第354行

            <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团队,请修复它,可能是由Ant 1.8中引入的一个错误功能造成的。只需将该名称的属性添加到
javac
任务中,将其设置为false,然后忘记它曾经发生过


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

Android SDK的一个解决方法是将属性设置为
“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

谢谢你的评论。事实上,这很容易修复,但对于Android SDK来说并非如此。目标是在android sdk脚本中定义的。build.properties也被称为ant.properties吗?我还没有找到build.properties,创建此文件后,仍然会打印此警告。但将其添加到project.properties将解决此问题。我可以配置我的SDK,使此代码在创建android项目时自动添加到project.properties中吗?可能会有帮助