prongs
prongs

Reputation: 9606

Android SDK source code

I need to look at the .java files of the android sdk. I have developed applications before but I never needed to look at them so it wasn't a problem then. I saw there is a jar file android.jar that contains all the class files structured but actual sources are not there. git gives various problems to me because I am behind a weird proxy so http://source.android.com/source/using-eclipse.html hasn't been very helpful. What should I do?

EDIT: I'm talking about the java files, just to clarify. And in case you are okay with browsing the code online, Where can I find Android source code online? http://www.google.com/codesearch/p?hl=en#uX1GffpyOZk/core/java/android/

Upvotes: 20

Views: 28626

Answers (6)

RBrink
RBrink

Reputation: 209

You can find all Android API source code via the link https://dl.google.com/android/repository/repository2-2.xml

Search for (example) Sources for Android 32 and get the corresponding url value for the right filename. Now you can download it from https://dl.google.com/android/repository/sources-32_r01.zip

Upvotes: 0

auspicious99
auspicious99

Reputation: 4311

The links in the other 2 answers, http://hala01.com/ and http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android are no longer working.

You can download and view android SDK source code from this site. As of today in October 2021, source code of up to API level 31 is available.

Since such websites may become unavailable in the future, you may want to download local copies for safe keeping.

Upvotes: 0

Chepech
Chepech

Reputation: 5541

Just open the Android SDK Manager and select the Sources for Android SDK of the API level you are trying to support and click Install packages:

(In this case I selected those for SDK v4.3 API-18 and SDK v4.2.2 API-17 but I already have them installed) Eclipse Android SDK Manager

If for some reason you SDK manager button doesn't show up on the Eclipse toolbar, follow this recommendations.

To link the source code to Eclipse just follow this instructions; Android Sources are usually under [ANDROID_SDK_FOLDER]/sdk/sources/android-[API_LEVEL]

Upvotes: 20

a4vi2r
a4vi2r

Reputation: 101

You can browse the .java files of the Android SDK here:

http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android

Upvotes: 2

user1544187
user1544187

Reputation: 21

It is a online latest linux and android source code browsing website.

Android/Linux Source Code Cross Reference http://hala01.com/

Upvotes: 2

Heiko Rupp
Heiko Rupp

Reputation: 30934

You can download the ICS sources via the adk manager to your local machine and then attach them to your project in you IDE. See e.g. the blog of Lars Vogel

Upvotes: 4

Related Questions