开发者

How can I build an Android project using ant4Eclipse?

开发者 https://www.devze.com 2023-04-12 05:20 出处:网络
I am attempting to build an Android application -- that had previously only been build using Eclipse -- using ant4Eclipse to automate the build.It has two projects, one that gets built as a JAR, and t

I am attempting to build an Android application -- that had previously only been build using Eclipse -- using ant4Eclipse to automate the build. It has two projects, one that gets built as a JAR, and the APK (which references the JAR). Both projects reference Android libraries.

The desired macro build process is:

  1. Build the JAR project (called XX)
  2. Export the JAR project into the APK project's lib folder
  3. Build the APK project

Right now, I'm just trying to get the JAR to build. I'm sure I'll run into more problems down the line with the second proj开发者_如何学运维ect but...one thing at a time. Here's my build.xml:

<project 
      name="XX"

       xmlns:ant4eclipse="antlib:org.ant4eclipse"
       xmlns:antcontrib="antlib:net.sf.antcontrib">

<property environment="env"/>
<property name="workspaceDirectory" value="${basedir}/.." />

<taskdef uri="antlib:net.sf.antcontrib"
         resource="net/sf/antcontrib/antlib.xml" />

<taskdef uri="antlib:org.ant4eclipse"
         resource="org/ant4eclipse/antlib.xml" />

<import file="${env.ANT_HOME}/lib/a4e-jdt-macros.xml"/>

<!-- This is here because ANT found this library reference in my project's .classpath and couldn't find it, so I added it thus -->
<ant4eclipse:jdtClassPathLibrary name="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK">
    <fileset dir="C:\eclipse\eclipse-galileo\plugins">
      <include name="com.android.ide.eclpise.*.jar"/>
    </fileset>
</ant4eclipse:jdtClassPathLibrary >
<!-- I borrowed this from http://stackoverflow.com/questions/5649348/ant4eclipse-examples -->
 <target name="compileAndJar">
    <buildJdtProject workspacedirectory="${workspaceDirectory}" projectname="XX">
      <finish>
        <jar destfile="${jar.dir}/myjar.jar">
          <ant4eclipse:jdtProjectFileSet 
              workspacedirectory="${workspaceDirectory}"
              projectname="${buildJdtProject.project.name}"/>
        </jar>
      </finish>
    </buildJdtProject>
  </target>
</project>

Now here's the error I'm getting when I run ant compileAndJar

BUILD FAILED
C:\dev\Project\Client\Android\XX\build.xml:31: The following error occurred while executing this line:
C:\bin\apache-ant-1.8.2\lib\a4e-jdt-macros.xml:77: The following error occurred while executing this line:
C:\bin\apache-ant-1.8.2\lib\a4e-jdt-macros.xml:133: Reference buildJdtProject.boot.classpath.path not found.

Also note I'm seeing this in the build output:

 [echo]   - bootclasspath      -> ${buildJdtProject.boot.classpath}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号