Android Studio: how to attach Android SDK sources?
For me on 2016/08/29 running android studio 2.1.3:
I had downloaded and was compiling against api 24 before the sources were released. I want to point at the source now that they've been released. Restarting Android Studio after downloading the sources in the SDK manager wasnt working.
I had to act like I was going to Edit the SDK location in the SDK Manager, when I did that, I could just click 'next' through the dialog and re-indexed the sdk stuff automatically.
Android Studio 3.2.1 reporting in: solved the issue by resetting SDK.
Preferences -> Appearance & Behavior -> System Settings -> Android SDK.
Click on Edit to the right of Android SDK location. Next, Next, Finish to complete the wizard and voila!
I'm unable to find the aforementioned gui options in v8.11 on osx however grep-fu tells me:
config is stored in ~/Library/Preferences/AndroidStudioBeta/options/jdk.table.xml
After editing this file (with Studio stopped) and restarting source mapping works fine for me.
diff --git a/options/jdk.table.xml b/options/jdk.table.xml
index 0112b91..33828b8 100644
--- a/options/jdk.table.xml
+++ b/options/jdk.table.xml
@@ -76,7 +76,7 @@
</javadocPath>
<sourcePath>
<root type="composite">
- <root type="simple" url="file:///Applications/Android Studio.app/sdk/sources/android-19" />
+ <root type="simple" url="file:///Users/tehdawgz/dev/android-sdk/sources/android-19" />
</root>
</sourcePath>
</roots>
Open your sdk manager from toolbar menus and download the "Sources for Android SDK" for the API level defined in your build.gradle file like
compileSdkVersion 19 // compile with API level 19
Nothing else needs to be done.
Note : Sources for SDK is available only for API levels 14 and above.
UPDATE ( Based on stable release 3.2.1):
Google changes the approach of shipping the sources, so lets see what changed.
Go to the following location
Preferences -> Apperance & Behaviour -> System Settings -> Android SDK
Quite lazy to navigate type SDK
in search and studio will help you to take to right place.
You can read the description, says mostly what to do. So after clicking on "show package details" you will see whether sources are installed or not (as shown in below picture) if it is not installed do install and you are good.