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 zi
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
I went through all of these solutions and none of them worked. Here is what I did to get it to work:
Navigate to the following folder: D:\\Android-SDK\android-sdk-windows\extras\android\support\v4
Run the command: javadoc -d docs -sourcepath src\java -subpackages android.support.v4
In your project's libs directory, create a file called android-support-v4.jar.properties
In the properties file, add the following lines (change the path to match yours):
doc=D:\Program Files\Android-SDK\android-sdk-windows\extras\android\support\v4\docs src=D:\Program Files\Android-SDK\android-sdk-windows\extras\android\support\v4\src
In Eclipse, bring up the properties dialog for the Build, then navigate to Java Build Path and select the Libraries tab.
Expand the support library. In my case the path is: D:\Program Files\Android-SDK\android-sdk-windows\extras\android\support\v4
Select Javadoc location. Click on the Edit button and then select the path to the docs. In my case it was: file:/D:/Program Files/Android-SDK/android-sdk-windows/extras/android/support/v4/docs/
Close everything, including Eclipse and restart. You should now be able to browse docs in your code.
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:
MKLINK /J {PROJECT_PATH}\android_docs {SDK_PATH}\docs\reference
Create the file libs/android-support-v4.jar.properties
with this content:
src=android-support-v4.jar
doc=../android_docs
Close the project and reopen it. Clean if necessary.
Thanks to this answer https://stackoverflow.com/a/11579339/933261
IF YOU'RE ON WINDOWS and get stuck for ages like me, make sure you escape your backsmashes in the properties file, or things will silently fail. (who makes silent failing loaders anyway...)
This this is my properties file:
src=android-support-v4.jar
doc=doc\\android-support-v4_doc
and my dir looks like this:
android-support-v4.docs.zip
android-support-v4.jar
android-support-v4.jar.properties
doc
close project and open, and it all works for me.
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
.
I generated this one based on wnafee's answer: https://dl.dropboxusercontent.com/u/31272696/android-support-v4.zip