开发者

Replicating system libraries for Android from Eclipse to Ant

开发者 https://www.devze.com 2023-03-09 20:39 出处:网络
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 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}" />
      开发者_StackOverflow      </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.

0

精彩评论

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