Android Studio: How to attach javadoc

前端 未结 10 1844
一向
一向 2020-12-04 09:47

It might be very trivial question, But I couldn\'t find any option to attach javadoc/source with local jar dependencies (in libs folder) in android project. I can\'t believe

相关标签:
10条回答
  • 2020-12-04 10:09

    in android studio if you use compileSdkVersion 23 in buidl.gradle and you have downloaded the SDK 23 document file and source file in SDK manager , the android API and java API doc and source will all show auto, you don't need to manual set.

    0 讨论(0)
  • 2020-12-04 10:10

    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
    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
    5. The result was:
    6. 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

    0 讨论(0)
  • 2020-12-04 10:12

    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

    0 讨论(0)
  • 2020-12-04 10:14

    Personally tested successfully!

    1.Project Structure(ctrl+alt+shift+s)

    2.SDK Location

    3.JDK Location

    4.UnCheck "Use embedded JDK(recommended)"

    5.Select your own jdk path(My Path:C:\Program Files\Java\jdk1.8.0_111)

    6.Synchronized(ctrl+alt+y)

    success

    0 讨论(0)
  • 2020-12-04 10:16

    After some investigation, I stumbled upon this:

    https://github.com/xujiaao/AARLinkSources

    Works like magic!

    0 讨论(0)
  • 2020-12-04 10:19

    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)

    0 讨论(0)
提交回复
热议问题