Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install javadoc for Android Compatibility Package?

How to generate custom javadoc for android 1.4 compatibility package?

The reference docs are available online (example), but is there some place where I can get a zip with javadoc available offline?

I suppose using the javadoc would be pretty simple, just a matter of setting the javadoc location for the compatibility jar.

like image 520
Corneliu Dascălu Avatar asked Dec 20 '11 14:12

Corneliu Dascălu


3 Answers

You can generate your javadoc offline on your own from the source code. Just navigate to your android sdk directory then do the following

cd <path_to_android_sdk>/extras/android/compatibility/v4/
mkdir docs

For Windows:

javadoc -d docs -sourcepath src\java -subpackages android.support.v4

For Linux/Mac:

javadoc -d docs -sourcepath src/java -subpackages android.support.v4

This will generate your javadocs for you locally in the docs directory that you just created.

Then in your eclipse android project, go to your project properties where you added the your android-support-v4.jar, edit it's properties and add the the path to the javadocs you just created.

That should work!

ADT 17+ issues:

As some of you have pointed out. There have been issues getting Eclipse to see the attached javadoc for ADT 17+. This is a known issue and a bug has been filed. This is not related to the way you generate the javadoc (as I described above), rather this is an issue with ADT 17+ integrating with Eclipse. Someone has described a workaround and it can be followed here:

http://code.google.com/p/android/issues/detail?id=28801

like image 137
wnafee Avatar answered Nov 17 '22 08:11

wnafee


Problem: If the android-support-v4.jar is in the /libs folder (as the ADT 17+ require) the javadoc is unavailable.


Edit: I have workarounded the problem by linking the offline version of the android javadoc to the android-support-v4.jar. As far as I know it is still not possible to link the online version (http://developer.android.com/reference). Steps:

  1. Download the Documentation for Android SDK from the SDK Manager. You can find it under the latest Android version (4.1)
  2. Link the javadoc folder to your project's folder, in Windows open a console and type: MKLINK /J {PROJECT_PATH}\android_docs {SDK_PATH}\docs\reference
  3. Create the file libs/android-support-v4.jar.properties with this content:

    src=android-support-v4.jar
    doc=../android_docs
    
  4. Close the project and reopen it. Clean if necessary.

  5. The javadoc is linked. Check it by going to any Support library class, like android.support.v4.app.FragmentActivity

Thanks to this answer https://stackoverflow.com/a/11579339/933261

like image 40
Juan T Avatar answered Nov 17 '22 06:11

Juan T


The answer by @wnafee is spot on, but if you are using Linux don't forget to use the forward slash character at this location like src/java.

like image 2
Tunji Avatar answered Nov 17 '22 06:11

Tunji