I have a main android app which has 2 jars in it’s libs folder. This android app includes a Java Source Project which has about 4 jars in it’s libs folder.
In the build.xml I have copied from android’s build.xml the ‘target name=”-compile”>’.
and added this:
<do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..." >
<!-- merge the project's own classpath and the tested project's classpath -->
<path id="project.javac.classpath" >
<path refid="project.all.jars.path" />
<path refid="tested.project.classpath" />
</path>
<javac
bootclasspathref="project.target.class.path"
classpathref="project.javac.classpath"
debug="true"
destdir="${out.classes.absolute.dir}"
encoding="${java.encoding}"
extdirs=""
fork="${need.javac.fork}"
includeantruntime="false"
source="${java.source}"
target="${java.target}"
verbose="${verbose}" >
<src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<src path="${javaproject.dir}" /> #THIS IS WHAT I ADDED which is defined in ANT.PROPERTIES
<compilerarg line="${java.compilerargs}" />
</javac>
So it references the java source project. The problem happens with the java source project’s jars which are in folder libs.
How do I also include them?
ps. copying them to android project’s libs folder is not an option.
You have the following:
Notice you’ve specified both the
sourceparameter and the<src path>sub-entity. Also notice that you have a reference tojavaproject.dir. What is this directory? Is it the source of the other project, the other project’s main directory, or something else?First, you shouldn’t use both
<src path>and thesrcdirparameters in your<javac>command. If you need only a single source directory path, you can use either thesrcdirparameter of the<javac>task, or the<src path>sub-entity. If you have more than one, you should not usesrcdir, and only use the<src path>sub-entity.Now back to your question…
If I understand you correctly, you want to specify multiple classpath folders in your
<javac>task. You can do this by removing theclasspathorclasspathrefparameters of the<javac>command, and simply specify multiple<classpath path>sub-entities like you do with source directories.I think you want something like this: