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:
- your lib name is: libxxx.jar
- 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.
- Right click in Project panel > External libraries > lib-name
- Click Library properties
- Click specify documentation URL
- And specify an URL. For my machine it was
file:///opt/android-sdk/extras/google/google_play_services/docs/reference
- The result was:
- And after a project sync I could browse the javadoc of the google play services
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:
- Open
Project structure
- Navigate to dependency that you want
- Press button from the screenshot and provide folder or file
Another way to attach sources:
- Step into class from library (Hover mouse over class name and do CMD + Left click or CMD + B)
- You will see decompiled version of class there menu on the top right side of editor "Attach sources.."
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
- Right click on the "Structure" tab and check "Split Mode" (so you can open both "Project" and "Structure" tabs at same time).
- Open both "Project" and "Structure" tabs at the same time.
- In "Project" tab select "Android" perspective and then select your module folder (e.g. "app")
- In "Structure" window you should now see list of all libraries, including your local *.jar
Continue as in answer from Matyas:
- Right click on wanted library and select "Library Properties..."
- 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).