Android Studio quick documentation always “fetching documentation”

后端 未结 12 1509
Happy的楠姐
Happy的楠姐 2020-11-29 18:14

I just move to Android studio from eclipse,I found that it always shows \"fetching documentation\" when I use quick documentation(Ctrl+Q),How to solve this?(I download docum

相关标签:
12条回答
  • 2020-11-29 18:45

    you can disable it, in Android Studio Preference

    Android Studio -> Preference -> Editor -> General -> Code Completion -> Show the documentation pupup in XX ms

    see my another answer Link

    0 讨论(0)
  • 2020-11-29 18:47

    The problem is Android Studio does not automatically update the source link of reference even when the documentation is already downloaded.

    The default link in jdk.table.xml is http://developer.android.com/reference/ (android studio tries to connect to this online server even if the network is blocked).

    To solve the problem, we can just redirect the reference to local source.

    MacOS

    On MacOS, the config file jdk.table.xml is under ~/Library/Preferences/AndroidStudio<version>/options/, and the docs are here: ~/Library/Android/sdk/docs/, or the custom path of your Android SDK.

    In jdk.table.xml, find all the lines:

    <root type="simple" url="http://developer.android.com/reference/">
    

    and modify them to

    <root type="simple" url="file://$USER_HOME$/Library/Android/sdk/docs/reference/">
    

    Windows

    On Windows, the file jdk.table.xml is under C:\Users\Name\.AndroidStudio<version>\config\options

    In AndroidStudio 3.3, modify to

    <root type="simple" url="file://$USER_HOME$/AppData/Local/Android/sdk/docs/reference"  />
    

    Android Studio (any os)

    Then, in File -> Invalidate Caches / Restart… select Invalidate, and retry using Quick Documentation. It should display instantly. If it doesn't, select Invalidate and Restart, and you should be good to go.

    0 讨论(0)
  • 2020-11-29 18:48

    On Windows

    File location of jdk.table.xml

    C:\Users\[your windows user name]\.AndroidStudio2.3\config\options\jdk.table.xml
    

    Notes

    • "." before AndroidStudio directory
    • version number after ".AndroidStudio". Be sure to edit the version number of Android Studio you're currently using. Previous versions will still have directories here as well.

    Line to edit

    Before

    <root type="simple" url="http://developer.android.com/reference/" />
    

    After

    <root type="simple" url="file://C:/Android/sdk/docs/reference" />
    

    Notes

    • C:/Android/sdk/docs/reference replace with Android SDK location on your machine
    • if you're copy/pasting location from File Explorer, replace backslashes (\) with forward slashes (/)
    • Each installed Android SDK version will have its own docs XML entry
    • Edit the line above in each SDK version found in jdk.table.xml (if you want quick docs when targeting those versions in build.gradle). e.g. If you have Android SDK API 25 installed, you'd find a section to edit under <name value="Android API 25 Platform" />

    Invalidate Caches / Restart after change!

    File -> Invalidate Caches / Restart...

    0 讨论(0)
  • 2020-11-29 18:50

    I found a solution.

    1. Close the android studio and delete the c:\Users\xxx.AndroidStudioBeta\ (in my case)
    2. Change the android sdk path name
    3. Open the android studio, it will ask for the sdk path

    Now you can change back the sdk path or using the new sdk path.

    You will find Ctrl+Q will work fine. (Don't import old setting)

    I think we need download the sdk document before set the sdk path to Android studio. But the Android studio should handle this case or give us a option to set it.

    0 讨论(0)
  • UPDATE: out-of-date, please check @Htea's answer.

    I was having the same issue as you. Here's what fixed it for me:

    • Make sure you have the Documentation package downloaded in SDK Manager.
    • Exit Studio if it's running.
    • Delete the file named "jdk.table.xml" located in ~/.AndroidStudioX.Y/config/options/ (remember to take a backup first!).
    • Relaunch Android Studio. should work correctly now and it should regenerate the file automatically.

    Note:

    • This worked for me on Ubuntu 14.04 & Android Studio 0.8.11 (EDIT: Several users are reporting this solution also works for newer versions of Android Studio).
    • If it still doesn't work, try deleting and re-downloading the Documentation package from inside Android SDK Manager then try the above steps.
    • If you're running Windows, the file is located at "%UserProfile%.AndroidStudio\config\options", and if you're running OS X, it's located at "~/Library/Preferences/AndroidStudio/options" (credits to @Gero and @Alex Lipov).

    Hope it helps.

    0 讨论(0)
  • 2020-11-29 18:51

    For android studio 3.4, all you need to do is go to sdk manager -> SDK Tools, check "Documentation for Android SDK" and click apply.

    It will automatically update the jdk.table.xml to point to the source you have downloaded.

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