How to attach javadoc or sources to jars in libs f

2019-01-01 05:51发布

New version of ADT r17 plugin for Eclipse added feature to automatically setup JAR dependencies. Any .jar files in the /libs folder are added to the build configuration now. Unfortunately Android Dependencies classpath container is non modifiable.

Non modifiable android dependencies classpath

How can i attach javadoc and sources to the automatically inserted .jar (from /libs folder)?

12条回答
十年一品温如言
2楼-- · 2019-01-01 06:26

On ADT 22 I could not access Javadoc for both commons-io-2.4.jar and android-support-v4.jar

This is the way I fixed it:

  1. Precondition: both libraries are listed under "Referenced Libraries".

  2. Right click on commons-io-2.4.jar and select Properties. This window appears:

enter image description here

commons-io-2.4.jar is bundled with commons-io-2.4-javadoc.jar, so I specified the Javadoc in archive External file path.

I did the same thing for the support library: right click on android-support-v4.jar and select Properties. This screen appears:

enter image description here

This time I specied the path to the source directory.

查看更多
只若初见
3楼-- · 2019-01-01 06:29

An answer come from http://code.google.com/p/android/issues/detail?id=27490#c21

In your libs folder, you must have:

doc(folder)
    foo_doc(folder)
        index.html
        ...
        ...
foo.jar
foo.jar.properties

And in your foo.jar.properties, just put doc=./doc/foo_doc

Maybe you will have to refresh your project, to clean it, to close it and to reopen it.

It works for me!

查看更多
皆成旧梦
4楼-- · 2019-01-01 06:30

For any given jar, if you would like to see the Javadoc help on the tooltip while coding, do the following: Right click your project > Properties > Java Build Path > Libraries Tab. Click the arrow next to your jar to expand.

Source attachment should point to the location of the actual jar (probably right in your java folder).

Javadoc location: You have two choices here: URL and archive. If your javadocs for this jar are in the form of a folder containing an index.html file at the first level, choose 'Javadoc URL' and point to that folder. If your javadocs are in a jar, choose 'Javadoc in archive' and point to the jar. Don't forget to restart your workspace/close and reopen your project to update the tooltip with the Javadoc info.

I hope this helps give a simple answer for what I believe should be a very simple task.

查看更多
零度萤火
5楼-- · 2019-01-01 06:35

For now, move the library you want Javadoc to lib. Them add that library to the Build Path and add the Javadoc.

Check this comment in the android issues.

查看更多
十年一品温如言
6楼-- · 2019-01-01 06:35

The library reference to commons-io-2.0.1.jar was broken when I upgraded to SDK Tools and ADT revision 17.

To resolve the problem I used Project -> Properties - > Java Build Path and I selected the Libraries tab. I deleted any reference to commons-io-2.0.1.jar and then used Add Jar to re-add commons-io-2.0.1.jar to the project. Then I click the ‘>’ arrow next to the library name to expand the library reference and I used the edit buttons to set the Source attachment and the Javadoc location.

Sorry I can't post an image as I don't have enough rep (please...).

查看更多
与君花间醉酒
7楼-- · 2019-01-01 06:35

Seems to be a moving target but, after having collected bits and pieces from many places (including answers to this very question that helped but failed to describe all necessary details, or maybe the system had changed slightly in the meantime), this seems to be the solution, at least as of now (August 28, 2013).

  • Open up a folder for your javadocs somewhere not inside your project.
  • Put your javadocs there unzipped, each into its own folder.
  • Inside your lib folder, add an xxx.jar.properties file for each lib you want to associate a javadoc with.
  • In that properties file, refer to the folder you unzipped the appropriate javadoc into (on Windows, escape the backslashes):

doc=d:\\Android\\javadoc\\libGoogleAnalyticsServices

  • Close and reopen your project in Eclipse (refreshing is not enough). You should now see the tooltips when you hover over the appropriate classes.

Failing to observe any of these steps (not unzipping the javadoc, referencing a file instead of a folder, etc) seems to break it.

查看更多
登录 后发表回答