Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error generating android project javadoc using Doclava

I'm trying to generate the documentation of my android project using javadoc & doclava. I downloaded the doclava jar and I'm trying to generate the doc through Project-> generate javadoc.

If I understood the mechanism, I have two ways to tell javadoc to use the doclava doclet:

1) Select "use custom doclet" with these options:

Doclet name: com.google.doclava.Doclava
Doclet Path: /full/path/of/my/doclava/dir/doclava-1.0.6.jar

2) Select "use standard doclet" and then, in the "javadoc options" put:

-doclet com.google.doclava.Doclava
-docletpath ${/full/path/of/my/doclava/dir/doclava-1.0.6.jar}

I have encountered these issues:

  • If I use the first method I can successfully generate the doc but it seems that android classes are not recognized. I get errors when doclava parses "import android.util.SparseArray"

  • If I use the second method I get this error: "javadoc: error - Cannot find doclet class com.google.doclava.Doclava 1 error"

As a matter of fact: if I don't use Doclava my documentation is correctly generated with links to the android apis.

I just want to create my project javadoc with links to the android/java doc (for the android/java objects) and have an "android look & feel".

like image 539
The Good Giant Avatar asked Apr 05 '13 08:04

The Good Giant


1 Answers

For those interested in the topic, I solved my problem using the first solution, here is the ant target used:

<target name="build-javadoc">
    <echo message="Creating Javadoc.." />
    <delete dir="${doc.dir}" />
    <javadoc    access="public" 
                destdir="${doc.dir}" 
                sourcepath="${src.dir}" 
                docletpath="${doclet.dir}/doclava-1.0.6.jar" 
                classpath="lib:libs:/Users/myusername/android-sdks/platforms/android-17/android.jar" 
                packagenames="com.my.package">


        <doclet name="com.google.doclava.Doclava">
            <!-- Title -->
            <param name="-hdf" />
            <param name="project.name" />
            <param name="Project Name" />

            <!-- Overview -->
            <param name="-overview" />
            <param name="src/overview-summary.html" />

            <!-- Template -->
            <param name="-templatedir" />
            <param name="Doc/My_Template" />

            <!-- federation Java -->
            <param name="-federate" />
            <param name="JDK" />
            <param name="http://download.oracle.com/javase/6/docs/api/index.html?" />
            <param name="-federationxml" />
            <param name="JDK" />
            <param name="http://doclava.googlecode.com/svn/static/api/openjdk-6.xml" />

            <!-- federation Android-->
            <param name="-federate" />
            <param name="android" />
            <param name="http://d.android.com/reference" />
            <param name="-federationxml" />
            <param name="android" />
            <param name="http://doclava.googlecode.com/svn/static/api/android-8.xml" />

        </doclet>
    </javadoc>

    <echo message="...Done" />
</target>

Hope it can help someone

like image 173
The Good Giant Avatar answered Oct 10 '22 02:10

The Good Giant