Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Android SDK Documentation offline

People also ask

How do I download Android SDK documents?

Open SDK Manager (located in android_sdk_dir/SDK Manager.exe ). In the latest API (4.2) select Documentation for Android SDK . Once downloaded, you can find the documentation in android_sdk_dir/docs .

Can Android SDK download without Android Studio?

You will need to download the Android SDK without Android Studio bundled. Go to Android SDK and navigate to the SDK Tools Only section. Copy the URL for the download that's appropriate for your build machine OS. Unzip and place the contents within your home directory.


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!

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.


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.


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.