Happy New Year!!! What better way to ring in 2021 than with a helpful tidbit? Last time, I wrote about some tips for debugging Gradle files. This week, I want to share how to get missing Android sources to show up in Android Studio.
Have you ever seen the message
"Sources for 'Android API <#> Platform' not found"? This can be a particularly annoying one, especially because it can be a little difficult to fix.
You may have likely run into the same issue I did, which was to download the sources (or refresh them), only to still see the error message. I bet you also tried restarting Android Studio, all to no avail.
Thankfully, we have Stack Overflow, and they have answers for just about anything.
And, the best news is, it's very easy to fix:
- Within Android Studio, navigate to Settings/Preferences -> Appearance & Behavior -> System Settings -> Android SDK.
- Click "Edit" to the right of the Android SDK location near the top of the window.
- Click "Next" all the way through the wizard until it has completed.
- Then restart Android Studio.
That should do it! Now you should be able to view Android sources again - which you might not realize how much you've been missing until you're able to see them again.
Here's the original post if you'd like to go upvote the working solution: https://stackoverflow.com/questions/36814755/sources-for-android-api-23-platform-not-found-android-studio-2-0/37283886#37283886
I hope your new year is off to a great start! And, please follow me on Medium if you're interested in being notified of future tidbits.
This tidbit was discovered on December 18, 2020.