Replicating system libraries for Android from Eclipse to Ant

I have a Android project which I'm building in Ant and I'm stuck on system libraries: In Eclipse I've defined two system libraries, each consisting of a few jars, which I then include in my projects. I've tried copying these jar files to the libs dir of the projects which use them and I'm still getting the same errors when compiling with ant.

Is there a difference between using a system library and including jars in the libs folder? Is there something I'm missing - maybe some way of defining a system library in ant itself?

UPDATE:

It's failing on the following code in main_rules.xml when executing ant compile

    <!-- Generates the R.java file for this project's resources. -->
<target name="-resource-src" depends="-dirs">
    <if condition="${manifest.hasCode}">
        <then>
            <echo>Generating R.java / Manifest.java from the resources...</echo>
            <aapt executable="${aapt}"
                    command="package"
                    verbose="${verbose}"
                    manifest="AndroidManifest.xml"
                    androidjar="${android.jar}"
                    rfolder="${gen.absolute.dir}">
                <res path="${resource.absolute.dir}" />
            </aapt>
        </then>
        <else>
            <echo>hasCode = false. Skipping...</echo>
        </else>
    </if>
</target>

I have added the libraries to the compile target javac task but this also doesn't seem to work.


In Ant, you generally need to put jars on classpath explicitly. They are not automatically added to classpath just by putting them in a lib directory.

Find where javac is done in your Ant buildfile and look at the classpath used. You will need to update this classpath to include each jar.

链接地址: http://www.djcxy.com/p/60372.html

上一篇: Ant:通过javac任务使用文件集

下一篇: Android系统库从Eclipse复制到Ant