35

I've downloaded Android SDK Documentation using SDK Manager, to use it with Android Studio v2.3.0.8, offline.

But everytime I press ctrl+q to show quick info about a type|type-member, it shows "Fetching Documentation...", and after waiting for ~20s, it shows the info.

I don't want that delay or using online help, and the local docs are in place, so why is that ? And what is the solution ?

Edit: This happens when I'm online, but no delay at all when I'm offline, As if the IDE tries to get a fresh version of docs.

4
  • What version of Android Studio are you using? In 2.3 this just works. I do not get any delay. Commented Mar 20, 2017 at 0:20
  • My Windows is on ssd, I don't think its a slow hdd problem. Commented Mar 20, 2017 at 0:22
  • @Code-Apprentice, I found in the comment of stackoverflow.com/a/16363093/7736965, that other people are having same|similar issue. Commented Mar 20, 2017 at 1:00
  • Possible duplicate of Android Studio quick documentation always "fetching documentation" Commented Jul 1, 2018 at 14:51

5 Answers 5

45

Improved solution for displaying documentation (from sources).

Found, that if you download documentation via SDK manager (it will be located in .../sdk/docs/reference), you're going to use only 24 API documentation. (Imagine, your project target SDK is 25 or 22, for instance).

Only 24 API in downloaded documentation

To fix this, you need:

  1. Delete documentation via SDK manager in Android Studio. Delete documenattion in SDK manager
  2. Right there, download sources for interested APIs (sources already contain documentation). Also I found, that fetching documentation from sources a bit faster comparing with offline one inside .../sdk/docs/reference. Download sources via SDK manager for interested APIs
  3. Delete all javadoc paths from jdk.table.xml. Path to this file on OS X: ~/Library/Preferences/AndroidStudio.../options/jdk.table.xml

    --> Delete all of these and all occurrences -->
    
    <javadocPath>
      <root type="composite">
        <root type="simple" url="http://developer.android.com/reference/" />
      </root>
    </javadocPath>
    
  4. Reboot Studio. Enjoy!
Sign up to request clarification or add additional context in comments.

2 Comments

You can use SDK Documentation for projects targeting different API, not only 24 API if you follow Mauricio answer here. Your solution works, but I didn't download api-24 platform or sources, just api-25 platform and source.
a sed oneliner to delete all the javadocPath blocks (on macos): sed -i.bak '/<javadocPath>/,/<\/javadocPath>/d' ~/Library/Preferences/AndroidStudio3.5/options/jdk.table.xml (you might want to make a backup first because the file will be modified in-place)
18

I downloaded it too, and I noticed that the Android Studio didn't generated the javadocPath properly in jdk.table.xml, that's how the file looks like (part that has the jdk tag with the name Android API ## Platform):

...
<jdk version="2">
  <name value="Android API 25 Platform" />
  <type value="Android SDK" />
  <homePath value="$USER_HOME$/android-sdk" />
  <roots>
      ...
    <javadocPath>
      <root type="composite">
        <root type="simple" url="http://developer.android.com/reference/" />
      </root>
    </javadocPath>
      ...

File is located at Android Studio Configuration folder/config/options/jdk.table.xml

Notice that the javadocPath is pointing to the online url, just change that to your local copy, in my case, the docs folder is in /home/mauricio/android-sdk/docs, in Windows is something like C:/android-sdk/docs.

The url structure that you have to follow is file://<path-to-sdk>/docs/reference

You have to point to the reference folder inside the docs.

It'll look something like this:

  <root type="simple" url="file:///home/mauricio/android-sdk/docs/reference" />
  <!-- if it's Windows -->
  <root type="simple" url="file://C:/android-sdk/docs/reference" />

Then, if it's running, restart the Android Studio and it's done.
I have a SSD too, and the offline documentation makes it open instantly.

Note: You have to do that in all javadocPath in the file (pretty easy using Replace all in any text editor), and when you download a new Android API, you have to do that again because it generates the url pointing to the online docs.


I think this is a bug in Android Studio, because the sourcePath and classPath is detected and generated correctly. It's worth reporting to them.

Comments

3

One way to fix config/options/jdk.table.xml is to stop the IDE, delete the file, ad restart. The IDE finds the installed SDKs, and it regenerates the options file.

I had issues with an upgrade from a preview release to 3.2 and docs were slow to display, and the above fixed the issue.

Comments

2

For sdk tools v26, using the command-line:

PATH_TO_SDK/tools/bin/sdkmanager "docs"

Then go to the directory PATH_TO_SDK/docs and open index.html file.

2 Comments

Thanks for providing the cmdline to download the docs instead of the GUI way
Warning: Failed to find package 'docs'. Using sdkmanager --version; 5.0.
0

You can download the offline docs on Android SDK Offline

Then unzip the tar folder Android.docset/Contents/Resources/Documents/developer.android.com to sdk/docs.

Then you can use the offline docs in AndroidStudio, but there is a little bug, the style of web is not right.

1 Comment

The links to download the documentation (frankfurt.kapeli.com/feeds/Android.tgz) on this site are broken (they go to the Dash site, which does not seem to supply android doc anymore). Anyone got an alternative or an old version?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.