Mycah
Mycah

Reputation: 4902

Sources for Android API 24 Platform not found (Android Studio 2.1)

In Android Studio 2.1 I was using API 24 just fine, then suddenly started seeing "Sources for Android API 24 Platform not found" warning in my AndroidManifest.xml.

Rerunning the Android SDK Manager setup in Android Studio, removing other non-supported APIs, etc didn't work for me. How do I fix this?

Upvotes: 26

Views: 16728

Answers (7)

Stefan L
Stefan L

Reputation: 1541

I get sources for most classes from android.jar, but not android.Manifest It has some useful comments e.g. about permissions that would be convenient to have available directly in Android Studio. android\sdk\platforms\android-29\android-stubs-src.jar does contain a useful android/Manifest.java source file, however it's missing from android\sdk\sources\android-29\android. There is no "attach sources" visible anywhere as far as I can see, just get the decompiled version.

After unzipping just android/Manifest.java and restarting Android Studio, it's there! Bit of a hack but better than no sources.

Upvotes: 0

Foenix
Foenix

Reputation: 558

File - Invalidate Cashes and Restart this works for me.

Upvotes: 0

John Constantine
John Constantine

Reputation: 11

enter image description here

No source for api 24.We should wait google publish sources for android sdk.

Upvotes: 0

evaitl
evaitl

Reputation: 1395

Re-installing may fix some problems, but this evening (7/11/16 2300 EST) the source for 24 isn't available yet. It'll show up when google says its soup:

enter image description here

Marshmallow (23) is the last version with sources.

[update 8/26]

SDK 24 has sources now. It's soup!

Upvotes: 0

Veer
Veer

Reputation: 1383

Try this method , I copied it from here.

Android Studio 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, next to complete the wizard and voila!

Upvotes: 71

NotesDea
NotesDea

Reputation: 19

There isn't source for android 24, only version 23 of the following Sources for Android SDK 23

Upvotes: 0

Mycah
Mycah

Reputation: 4902

After searching I found answers that were close enough to get me to my own answer for API 24. For me it was simply a matter of removing API 24, closing Android Studio, and (after reopening) letting Android Studio detect API 24 was missing and download it for me. I assume this would also work for other API versions.

UPDATE: As others have pointed out, API 24 did not have "Sources" listed in SDK Manager at the time this question was asked/answered. However, everything was working fine before and continues to work after following this answer. So that seems to be a bit of a technicality worth mentioning.

I have the app targeting and compiling for API 24 and on Google Play in Alpha testing.

Android N APIs are now final (as of 15 June 2016).

enter image description here

Steps (Mac):

  1. Open SDK Manager: Tools > Android > SDK Manager
  2. Remove API 24: Deselect Checkbox > Click OK, OK again to confirm removal
  3. Quit Android Studio (⌘Q)
  4. Reopen your project in Android Studio
  5. Install missing platform(s) and sync project
    • Click this clickable link in the Messages Gradle Sync panel enter image description here

Once the Gradle Sync finishes that should take care of it.

Upvotes: 5

Related Questions