2

After referencing just a few other questions, I found that none of those answers are working in my project. Dropping jars into the /libs folder of each individual module, the ant build runs correctly and produces output. After deleting all of the /libs folders and including an ant.properties file ( a.k.a. build.properties ) in every module I need, the ant build has stopped working.

ant.properties:

# This file is used to override default values used by the Ant build system.
#
# This file must be checked in Version Control Systems, as it is
# integral to the build system of your project.

# This file is only used by the Ant script.

# 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.

jar.libs.dir=../ExternalJars/libs

Build.xml

<property file="ant.properties" />

<loadproperties srcFile="project.properties" />

<!-- version-tag: 1 -->
 <import file="${sdk.dir}/tools/ant/build.xml" />

<target name="full-debug" depends="debug">
</target>

<target name="full-release" depends="clean,release">
</target>

As far as I can tell, the files are properly written - the pathing is all correct relative to the ant.properties file, jars are where they should be, modules use all of the correct classes and parts, etc.

Thoughts?

Community
  • 1
  • 1
Phill.Zitt
  • 343
  • 2
  • 16

2 Answers2

8

Based on the other answer, this is what I implemented to the build.xml script, to support the jar.libs.dir property:

<target name="-pre-compile">
    <property name="project.all.jars.path.temp" value="${toString:project.all.jars.path}" />
    <path id="project.all.jars.path">
        <path path="${project.all.jars.path.temp}"/>
        <fileset dir="${jar.libs.dir}">
            <include name="*.jar"/>
        </fileset>
    </path>
</target>

Since the <path path="..."/> is used, it looks safe enough, even if more than one JAR file is added by default to the path element.

Panayotis
  • 1,638
  • 21
  • 28
  • 2
    In my experience, this would discard the existing project.all.jars.path content (tried Ant 1.8.4, 1.9.0 and 1.9.2, got the same result). Adding a just below the opening target tag and referencing it like inside the path override seems to fix the issue. – Dmitry Polyanitsa Aug 26 '13 at 13:54
3

this is a known bug: http://code.google.com/p/android/issues/detail?id=33194

dljava
  • 1,700
  • 16
  • 13