7

In Android Studio editor, the ctrl-q and/or code completion popup to show related documentation does not give documentation on object. I only get a window claiming that URL's have been searched.

the following is the text from a typical popup: (with my notes in parentheses)

java.io.File public String toString()
 Overrides:

toString in class Object
The following documentation urls were checked:  
http://developer.android.com/reference/java/io/File.html#toString--
http://developer.android.com/reference/java/io/File.html#toString()

       Edit API docs paths (<-- acts like link, does nothing)

`toString()` on developer.android.com (<-- is link, goes to ../File)
`toString()` on developer.android.com (<-- is link, goes to ../File.html#toString())

What am I missing? Can I fix this? Setup is api 29

Chuck
  • 171

2 Answers2

1

Installing the specific sdk versions used by my project (like suggested by Ramhound in the comments) fixed the problem for me.

(Through Tools -> SDK Manager)

0

Alternative solution to downloading SDK via manager

  1. Create any data structure that doesn't fetch documentation e.g. a HashMap Map<String, String> testMap = new HashMap<>();
  2. add any random thing to the Hashmap: testMap.put("test", "test");
  3. Put your cursor on the put() method that you just call above, go to definition by holding ctrl + b or cmd+b for mac users.
  4. De-compile the byte code and just click decide later.
  5. When it opens up, you should see at the top ~
    • "Cannot find source for Android API: xx(depending on what version your compile sdk is set to in build.gradle(app))"
  6. Click an option to Download the source (or refresh)
  7. After download finishes let indexes refresh!

Documentation should now work within the IDE.

Credits to the amani-arman on stack overflow