2012-02-27 67 views
3

錯誤是在底部

嘗試運行build.xml文件,當我在-build-setup任務期間收到此錯誤(由android sdk生成)爲一個項目,有一對夫婦依賴和我試圖運行的任務是-compile。我使用eclipse來使用自動構建函數來運行這個ant文件。我將這個build.xml文件作爲項目的構建者,並將其設置爲唯一的bulider。然後設定的目標爲以下:

<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="-compile,"/> 
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="-compile,"/> 
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="clean,"/> 
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="clean,nodeps,debug,"/> 

兩者的依存關係也在利用產生build.xml文件。我所有的build.xml文件都在執行-compile任務。發佈在底部是build.xml文件中的-compile任務。

的依賴項目的Android庫,我已經在Eclipse配置爲如下的Ant構建:

<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="nodeps,debug,"/> 
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="nodeps,debug,"/> 
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="clean,"/> 
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="debug,"/> 

爲什麼我不斷收到這個錯誤,我該如何解決這一問題?



我目前的工作圍繞

如果我改變AppNameA的目標,以下面,它工作正常。但是,我不想這麼做......當你真正想要的是在這些點上進行編譯時,調試需要很長的時間。

<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="debug,"/> 
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="debug,"/> 
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="clean,"/> 
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="clean,nodeps,debug,"/> 

這裏是確切的錯誤:

BUILD FAILED 
C:\Users\myusername\android-sdks\tools\ant\build.xml:485: The following error occurred while executing this line: 
Target "${build.target}" does not exist in the project "AppNameA". 

-compile任務是在build.xml文件。

(基本上跟原來一樣,有一個微小的變化......)

<!-- Compiles this project's .java files into .class files. --> 
<target name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile"> 
    <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..."> 
     <!-- If android rules are used for a test project, its classpath should include 
      tested project's location --> 
     <condition property="extensible.classpath" 
       value="${tested.project.absolute.dir}/bin/classes" 
       else="."> 
      <isset property="tested.project.absolute.dir" /> 
     </condition> 
     <condition property="extensible.libs.classpath" 
       value="${tested.project.absolute.dir}/${jar.libs.dir}" 
       else="${jar.libs.dir}"> 
      <isset property="tested.project.absolute.dir" /> 
     </condition> 
     <javac encoding="${java.encoding}" 
       source="${java.source}" target="${java.target}" 
       debug="true" extdirs="" includeantruntime="false" 
       destdir="${out.classes.absolute.dir}" 
       bootclasspathref="android.target.classpath" 
       verbose="${verbose}" 
       classpath="${extensible.classpath}" 
       classpathref="jar.libs.ref" 
       excludes="${filesToExcludeFromCompile}" 
       failonerror="true" 
      > 
      <src path="${source.absolute.dir}" /> 
      <src path="${gen.absolute.dir}" /> 
      <classpath> 
       <fileset dir="${extensible.libs.classpath}" includes="*.jar" /> 
      </classpath> 
      <compilerarg line="${java.compilerargs}" /> 
     </javac> 
     <!-- if the project is a library then we generate a jar file --> 
     <if condition="${project.is.library}"> 
      <then> 
       <echo>Creating library output jar file...</echo> 
       <property name="out.library.jar.file" location="${out.absolute.dir}/classes.jar" /> 
       <if> 
        <condition> 
         <length string="${android.package.excludes}" trim="true" when="greater" length="0" /> 
        </condition> 
        <then> 
         <echo>Custom jar packaging exclusion: ${android.package.excludes}</echo> 
        </then> 
       </if> 
       <jar destfile="${out.library.jar.file}"> 
        <fileset dir="${out.classes.absolute.dir}" excludes="**/R.class **/R$*.class"/> 
        <fileset dir="${source.absolute.dir}" excludes="**/*.java ${android.package.excludes}" /> 
       </jar> 
      </then> 
     </if> 

     <!-- if the project is instrumented, intrument the classes --> 
     <if condition="${build.is.instrumented}"> 
      <then> 
       <echo>Instrumenting classes from ${out.absolute.dir}/classes...</echo> 
       <!-- It only instruments class files, not any external libs --> 
       <emma enabled="true"> 
        <instr verbosity="${verbosity}" 
          mode="overwrite" 
          instrpath="${out.absolute.dir}/classes" 
          outdir="${out.absolute.dir}/classes"> 
        </instr> 
        <!-- TODO: exclusion filters on R*.class and allowing custom exclusion from 
         user defined file --> 
       </emma> 
      </then> 
     </if> 
    </do-only-if-manifest-hasCode> 
</target> 

回答

2

我想通了這個問題。

${build.target}-set-debug-mode-set-release-mode任務實際上是設置。因此,直接調用-compile任務時,它不會將這些任務中的任何一個作爲依賴項調用。

因此,${build.target}從未實際設置。

對此的解決辦法是重寫的任務之一,並把它設置${build.target}時沒有設置。讓它設置爲您認可的某種默認值。

+0

您可以提供示例代碼和xml以瞭解您如何解決此問題?由於 – Lisa 2012-07-24 09:25:24

+0

你可能嘗試從您的自定義'-compile'目標中調用'-set-調試mode'目標。把它稱爲你做的第一件事。但是我們實際上放棄了這個想法,並且認爲不值得嘗試在eclipse中使用我們的外部構建過程。所以,我無法進一步測試它。 – prolink007 2012-07-24 13:26:58

0

稱爲java.target屬性是在你的build.xml文件未設置。

我認爲該消息是由下面的ANT任務,其中有所謂的「目標」的屬性拋出:

<javac encoding="${java.encoding}" 
     source="${java.source}" target="${java.target}" 
     debug="true" extdirs="" includeantruntime="false" 
     destdir="${out.classes.absolute.dir}" 
     bootclasspathref="android.target.classpath" 
     verbose="${verbose}" 
     classpath="${extensible.classpath}" 
     classpathref="jar.libs.ref" 
     excludes="${filesToExcludeFromCompile}" 
     failonerror="true" 
    > 
+0

是該屬性要求的Java的目標版本?我也並不認爲這是問題,但我將它設置爲你給我在響應此消息什麼都額外信息,並給它一展身手。謝謝 – prolink007 2012-02-28 01:10:29

+0

在android父build.xml中,他們已經設置了這個值。它被設置爲1.5。它是android提供的父'build.xml'中的'第51行'。這仍然沒有解決。 – prolink007 2012-02-28 14:39:45

相關問題