views:

646

answers:

3

Hello, i was hoping someone could help me in generating a javadoc for my eclipse project. When i select 'Generate Javadoc' from the project menu I get lots of errors like

cannot find symbol
symbol  : class ListView

everytime a class referencing an Android API class, so i only get Javadocs outputted for the classes that do not reference any android api stuff. My app compiles and runs correctly and on the project setting the Android 1.6 lib is present (on the build path - external jars section).

Any ideas what im doing wrong?

Thanks.

Dori

+1  A: 

Certainly there's a problem generating android javadoc from Eclipse. I've found a workaround using maven and the javadoc plugin with the following configuration (pom.xml):

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    <modelVersion>4.0.0</modelVersion>
    <groupId>group</groupId>
    <artifactId>artifact</artifactId>
    <version>0.0.5-SNAPSHOT</version>
    <build>
     <sourceDirectory>src</sourceDirectory>
     <plugins>
     <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-javadoc-plugin</artifactId>
     <version>2.6.1</version>
  <configuration>
  <links>
     <link>file:/opt/android-sdk/docs/reference/</link>
   </links>
  </configuration>
  </plugin>
 </plugins>
    </build>
    <dependencies>
     <dependency>
      <groupId>android</groupId>
      <artifactId>android</artifactId>
      <version>1.5</version>
      <scope>provided</scope>
     </dependency>
      </dependencies>
</project>    

adapt your android sdk directory (/opt/android-sdk/ in the example). Android libs should also be available in your local maven repository, you may use android-mvn-install script to install them.

Once this pom.xml is in your project root directory you will be able to Run As -> Maven build ... and configure a javadoc:javadoc goal (provided that eclipse has m2eclipse plugin installed). By default output will be in target directory.

dtmilano
A: 

I was able to get Javadocs generated for all my classes by making sure that I had the "Documentation for Android SDK" component installed in the Android SDK and AVD Manager, and selecting android.jar as a reference archive in step 2 of the Javadoc generation.

It didn't generate links to the reference docs, but it did create docs for all of my classes.

Erich Douglass
A: 

You can definitely do that with Maven. Ideally you can use the Maven Android Plugin for your complete build. That will also allow you to use things like findbugs, checkstyle, pmd and so on.

Documentation is on the project wiki as well as in the book Maven: The Complete Reference http://www.sonatype.com/books/mvnref-book/reference/android-dev.html

Manfred Moser