如何安装Android兼容包的javadoc?

发布于 2024-12-21 21:41:13 字数 267 浏览 1 评论 0原文

如何为 android 1.4 兼容包生成自定义 javadoc?

参考文档可在线获取(示例) ,但是有什么地方可以获取带有离线可用 javadoc 的 zip 吗?

我想使用 javadoc 会非常简单,只需设置兼容性 jar 的 javadoc 位置即可。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

坏尐絯 2024-12-28 21:41:13

您可以从源代码中自行离线生成 javadoc。只需导航到您的 android sdk 目录,然后执行以下操作

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

对于 Windows:

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

对于 Linux/Mac:

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

这将在您刚刚创建的 docs 目录中本地生成 javadocs。

然后在您的 Eclipse Android 项目中,转到您添加了 android-support-v4.jar 的项目属性,编辑其属性并添加您刚刚创建的 javadoc 的路径。

那应该有效!

ADT 17+ 问题:

正如你们中的一些人所指出的。让 Eclipse 查看 ADT 17+ 的附加 javadoc 时出现问题。这是一个已知问题,并且已提交错误。这与生成 javadoc 的方式无关(如上所述),而是 ADT 17+ 与 Eclipse 集成的问题。有人描述了一种解决方法,可以在此处遵循:

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

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

金橙橙 2024-12-28 21:41:13

问题:如果 android-support-v4.jar 位于 /libs 文件夹中(按照 ADT 17+ 的要求),则 javadoc 不可用。


编辑:我通过将离线版本的 android javadoc 链接到 android-support-v4.jar 解决了该问题。据我所知,仍然无法链接在线版本(http://developer.android.com/参考)。步骤:

  1. 从 SDK Manager 下载 Android SDK 的文档。您可以在最新的 Android 版本 (4.1) 下找到它。
  2. 将 javadoc 文件夹链接到您的项目文件夹,在 Windows 中打开控制台并输入:MKLINK /J {PROJECT_PATH}\android_docs {SDK_PATH}\docs\reference
  3. 使用以下内容创建文件 libs/android-support-v4.jar.properties

    src=android-support-v4.jar
    doc=../android_docs
    
  4. 关闭项目并重新打开它。如有必要,请进行清理。

  5. javadoc 已链接。通过转到任何支持库类来检查它,例如 android.support.v4.app.FragmentActivity

感谢这个答案 https://stackoverflow。 com/a/11579339/933261

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

感情洁癖 2024-12-28 21:41:13

@wnafee 的答案很准确,但如果您使用的是 Linux,请不要忘记在此位置使用正斜杠字符,例如 src/java

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.

情丝乱 2024-12-28 21:41:13

如果您在 WINDOWS 上并且像我一样被困了很长时间,请确保您在属性文件中逃脱了 backsmashes,否则事情会默默地失败。 (无论如何,谁会导致静默失败加载程序...)

这是我的属性文件:

src=android-support-v4.jar
doc=doc\\android-support-v4_doc

我的目录如下所示:

android-support-v4.docs.zip
android-support-v4.jar
android-support-v4.jar.properties
doc

关闭项目并打开,这一切都对我有用。

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.

半仙 2024-12-28 21:41:13

我经历了所有这些解决方案,但没有一个有效。以下是我为使其正常工作所做的操作:

  1. 导航到以下文件夹:
    D:\\Android-SDK\android-sdk-windows\extras\android\support\v4

  2. 运行命令:
    javadoc -d docs -sourcepath src\java -subpackages android.support.v4

  3. 在项目的 libs 目录中,创建一个名为 android-support-v4.jar.properties 的文件

  4. 在属性文件中,添加以下行(更改路径以匹配您的路径):

    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. 在 Eclipse 中,打开构建的属性对话框,然后导航到 Java 构建路径并选择Libraries 选项卡。

  6. 扩展支持库。就我而言,路径是:
    D:\Program Files\Android-SDK\android-sdk-windows\extras\android\support\v4

  7. 选择 Javadoc 位置。单击“编辑”按钮,然后选择文档的路径。就我而言,是:
    file:/D:/Program Files/Android-SDK/android-sdk-windows/extras/android/support/v4/docs/

  8. 关闭所有内容,包括 Eclipse 并重新启动。您现在应该能够浏览代码中的文档。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文