I just moved to Android Studio from Eclipse, and I found that it always shows "fetching documentation" when I use quick documentation (Ctrl+Q).
How can I solve this problem? I downloaded the documentation for API 19, and the problem persists.
I just moved to Android Studio from Eclipse, and I found that it always shows "fetching documentation" when I use quick documentation (Ctrl+Q).
How can I solve this problem? I downloaded the documentation for API 19, and the problem persists.
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.
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/">
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" />
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.
<root type="simple" url="file://$USER_HOME$/AppData/Local/Android/sdk/docs/reference" />
in my in C:\Users\MY_USERNAME\.AndroidStudio3.0\config\options\jdk.table.xml file. Wouldn't just one of these rows be enough instead?? –
Horst <javadocPath>
with something like url="file://$USER_HOME$/Library/Android/sdk/docs/reference/"
even if "docs/reference/" does not exist in your Android SDK folder. It will somehow still work. –
Respectively $HOME/.AndroidStudioPreview3.2/config/options
(replacing .AndroidStudioPreview3.2
with the IDE variant that you are using) –
Concomitant On the newest Android Studio versions you can do as following:
Tools > SDK Manager
SDK Platforms
tabShow Package Details
checkbox, at the bottom right, is checked.Sources for Android [API_Level]
and click apply.Go to: Tools > Android > SDK Manager
. Select SDK Tools
tab and:
UPDATE: out-of-date, please check @Htea's answer.
I was having the same issue as you. Here's what fixed it for me:
Note:
Hope it helps.
.AndroidStudio
(no Beta in the name). –
Joost The reason for me was that I had not downloaded sources for my SDK version defined by compileSdkVersion
property in the build file (now called compileSdk
in AGP 7.0.0).
So, in Android Studio 4.0 and higher do this:
Go to Settings 🡲 Android SDK 🡲 SDK Platforms tab 🡲 select Show Package Details checkbox at the bottom 🡲 under your target API Android section check the Sources for Android xx 🡲 click Ok and wait for the download to finish.
Thanks to Cyn45 for their answer.
As other answers said, it's because the Android Studio is trying to fetch the javadoc online (from http://developer.android.com/reference/
), which will be very slow if the network not good, especially in China because google is blocked. So we should change this setting and let Android Studio fetch javadoc locally:
Android SDK Manager
.jdk.table.xml
, replace all http://developer.android.com/reference/
to the path to your sdk reference folder. For example file://$USER_HOME$/tools/adt-bundle-mac/sdk/docs/reference
on my Mac.On OS X, if you have used several versions of Android Studio, there may be several configuration folders for each version (under ~/Library/Preferences/
), you should change the jdk.table.xml
in the right folder, in my case I should edit jdk.table.xml
under the folder AndroidStudio2.2
.
File location of jdk.table.xml
C:\Users\[your windows user name]\.AndroidStudio2.3\config\options\jdk.table.xml
Notes
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\
) with forward slashes (/
)<name value="Android API 25 Platform" />
File -> Invalidate Caches / Restart...
I also found this issue with Android studio 0.8.9 & 0.8.14, here's a simple solution:
File -> Invalid Caches/Restart -> Invalidate and Restart
Sometimes the documentation package may be missing or not up-to-date.
Try open the Android SDK manager(Tool->Android->SDK Manager) and install the 'Documentation for Android SDK' in the latest release, for now it's Android 5.0(API 21), then restart Android studio.
If this happens again, just invalidate the caches.
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.
I found a solution.
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.
For a quick workaround edit /etc/hosts
(or C:\Windows\System32\Drivers\etc\hosts
) file and add the line:
0.0.0.0 developer.android.com
This will prevent it but you can comment it out when you need to fetch the latest or ones not cached or read the docs online.
UPDATE: From unknown exactly version, just simply download Android Documentation
in SDK Manager
could fix the problem. My 3.4.1
do so.
But I don't know whether older version could works as well or not.
I meet the same issue too,but I solved it just now. I used the Android Studio with SDK before I solved it,and then I download a Android Studio Zip without SDK,and run it,and the issue disappeared. You can try it.
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
© 2022 - 2024 — McMap. All rights reserved.