简体   繁体   中英

Android SDK Tools R20, javadocs for 3rd party libraries and Ant builds

Since yesterday's release of SDK API 16 and SDK tools R20, I've been unable to make work the combination of the new tools, being able to see the javadoc hovers in Eclipse and being able to do an Ant build from the command line.

When R17 tools was released it became necessary to put all 3rd party jars in the new libs directory. Unfortunately this meant that you couldn't specify the location of the javadocs for a jar in there. The widely used workaround was to put the jars in another folder, specify that in the build properties and export it. This worked for me until R20 came along.

My build.xml in the simplest example is the standard one from a newly created sample project, except for passing the projectname in from a properties file. (I put the jar in a 'lib' directory)

I had an ant.properties file of the form:

projectname=MyProject

jar.libs.dir=lib

build.sysclasspath=last
workspace.dir=/dev/projects/EclipseIndigo/AndroidWorkTwo
outbasebase.dir=/dev/projects/AntBuilds
base.dir=${workspace.dir}/${projectname}

source.dir=${base.dir}/src
outbase.dir=${outbasebase.dir}/${projectname}
ant.project.name=${projectname}
out.dir=${outbase.dir}/bin
layout.dir=${base.dir}/res/layout

key.store=<hidden>
key.alias=<hidden>
key.store.password=<hidden>
key.alias.password=<hidden>

This now fails at the compile target in an Ant command line build (ant release) as it can't find the classes in the jar. Setting various combinations of project.all.jars.path and tested.project.classpath don't make it work either.

Does anyone have any suggestions for restoring the old functionality?

Despite the remarks in comment 21 of this issue , adding a .properties file doesn't enable the javadocs if the jars are in libs. (Putting the jars in libs still enables my custom build.xmls to work with Ant though, so that's something!) It seems that fixing the complicated integration of library projects and testing regimes is considered important, whilst having broken basic functionality like javadocs support in an IDE can be safely ignored.

The only thing I found which works is the answer here . I add this to my custom_rules.xml template and it seems to be working fine. I supposed it's only a few more lines than adding path to the ant.properties file until we get a better solution.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM