Android Studio: How to attach javadoc

I found a solution just now since I can't find any other solution for a long time.

suppose:

  1. your lib name is: libxxx.jar
  2. javadoc name is docs.zip

under folder .idea/libraries, you can find libxxx.xml. replace JAVADOC with

<JAVADOC>
  <root url="jar://C:/yourpath/doc.zip!/" />
</JAVADOC>

then ctrl+alt+y to sync the project. (Don't do "Sync Project with Gradle files", it will delete the changes)


I've found & tested a way in which we can add the javadocs without loosing them after a gradle sync.

  1. Right click in Project panel > External libraries > lib-name
  2. Click Library properties Lib props
  3. Click specify documentation URL
  4. And specify an URL. For my machine it was file:///opt/android-sdk/extras/google/google_play_services/docs/reference Add doc url
  5. The result was: added jdoc
  6. And after a project sync I could browse the javadoc of the google play services google play services maps javadoc

Note:

This placed the same JAVADOC entry in the xml identified by Jason but doesn't disappear after doing a sync with gradle


It is possible:

  1. Open Project structure
  2. Navigate to dependency that you want
  3. Press button from the screenshot and provide folder or file

screenshot 1

Another way to attach sources:

  1. Step into class from library (Hover mouse over class name and do CMD + Left click or CMD + B)
  2. You will see decompiled version of class there menu on the top right side of editor "Attach sources.."

screenshot 2


I had problem with answer from Matyas that I wasn't seeing my local .jar library in the External Libraries list, because it only show maven attached libs.

Solution is mentioned here: https://code.google.com/p/android/issues/detail?id=73087#c26

  1. Right click on the "Structure" tab and check "Split Mode" (so you can open both "Project" and "Structure" tabs at same time).
  2. Open both "Project" and "Structure" tabs at the same time.
  3. In "Project" tab select "Android" perspective and then select your module folder (e.g. "app")
  4. In "Structure" window you should now see list of all libraries, including your local *.jar

Continue as in answer from Matyas:

  1. Right click on wanted library and select "Library Properties..."
  2. If you have *.jar with javadocs locally, you can press "add" button (green "+") and search for the file on your disk (you don't have to type "file://" path manually).