2011-01-27 57 views
11

「includeAntRuntime」在android ant腳本中未設置爲false,並且每次構建我的應用程序時都會給我帶來惱人的警告。「includeAntRuntime」未設置爲android ant腳本?

[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 - * /工具/ 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團隊,請修正它?

+0

http://www.enterra-inc.com/techzone/using_ant_android_applications_building/可能有幫助 – 2012-01-13 03:30:53

回答

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 
+0

謝謝,它的工作 – dongshengcn 2011-03-18 16:50:21

1

這是由Ant 1.8中引入的錯誤引起的。只需將該名稱的屬性添加到javac任務中,將其設置爲false,並忘記曾發生過。

即。在您的javac Ant任務中設置屬性includeAntRuntime。 Ant用戶手冊給出了以下屬性描述:「除非設置了build.sysclasspath,否則屬性includeAntRuntime默認爲yes,通常最好將其設置爲false,以便腳本的行爲對其運行環境不敏感」。

+0

感謝您的評論。事實上,這很容易解決,但不適用於Android SDK。目標是在android sdk腳本中定義的。 – dongshengcn 2011-01-28 16:55:09