How to install javadoc for Android Compatibility Package?

流过昼夜 提交于 2019-12-18 10:46:07

问题


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.


回答1:


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




回答2:


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




回答3:


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.




回答4:


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.




回答5:


I generated this one based on wnafee's answer: https://dl.dropboxusercontent.com/u/31272696/android-support-v4.zip




回答6:


I went through all of these solutions and none of them worked. Here is what I did to get it to work:

  1. Navigate to the following folder: D:\\Android-SDK\android-sdk-windows\extras\android\support\v4

  2. Run the command: javadoc -d docs -sourcepath src\java -subpackages android.support.v4

  3. In your project's libs directory, create a file called android-support-v4.jar.properties

  4. 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

  5. In Eclipse, bring up the properties dialog for the Build, then navigate to Java Build Path and select the Libraries tab.

  6. Expand the support library. In my case the path is: D:\Program Files\Android-SDK\android-sdk-windows\extras\android\support\v4

  7. 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/

  8. Close everything, including Eclipse and restart. You should now be able to browse docs in your code.



来源:https://stackoverflow.com/questions/8577190/how-to-install-javadoc-for-android-compatibility-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!