| Note: There is a later post created in 3July09 titled Android: How to download the latest zip Android Source Code easily and using it in Intellij on how to obtain the source directly from the Android code server. |
A great way to learn about a Java library and framework is to browse through their innards (source code) ad hoc-ly during project development. Sometimes a method or a class that seems so simple in its name might do much more and end up create side-effect unexpectedly which result in hard-to-debug code. In addition, API documentation tends to be vague and brief that does not delve hard into detail. Hence, the source code of the Java library and framework is very indispensable resource for software development.
This is especially so for Android Mobile Application Development where it is still relatively new in term of maturity and acceptance. There is still currently one Android phone available in the market and the forthcoming v1.5 Android platform codename Cupcake make the Android development all the more challenging. Hence having the full source code of Android can at least assist in understanding and learning on what is still a new mobile platform. However, Android SDK does not come with source code and it is up to the developer to download it from the Google code server. It is quite involving to download those source code so what if someone already do the hard work of getting and packaging the source code for you ?

Why not just JAD the android.jar ?
JAD Java Decompiler is a free popular tool that can be used as standalone or integrate with leading IDE to decompile Java class into its source code. When used with IDE, it allows one quickly to decompile third-party library (where source code is not available) class in real-time.
So why not just simply use JAD to decompile those class file from android.jar ? It is because JAD doesn’t work for Android. The decompiled source code does not have any useful method body and meaninglessly replaced by stub code "throw new RuntimeException("Stub!");"
For example, for the Activity.java file:
public Activity()
{
throw new RuntimeException("Stub!");
}protected void finalize()
throws Throwable
{
throw new RuntimeException("Stub!");
}public static long getInstanceCount()
{
throw new RuntimeException("Stub!");
}
etc
Getting the source code
Thank to someone by the name of rgruet in http://androidforums.com/android-developers/1045-source-code-android-jar.html who consolidate the source code of Android v1.5 into a zip file,
I packed the sources for android 1.5 (not a piece of cupcake
, and made the
archive temporarily available at http://rgruet.free.fr/public/android…upcake-src.zip (21.6MB). Please mirror it elsewhere before my ISP kills me!Create a directory sources/ inside your <android-SDK>/platforms/android-1.5/ directory, and unzip the archive there.
Richard
There are currently three known sources to download the source code (21.6 mb).
- http://rgruet.free.fr/public/android-1.5-cupcake-src.zip (rgruet )
- http://www.digginmobile.com/android.asp
- http://www.mediafire.com/download.php?ulnovo4wzde (My mirror)
Oh yes, download smart, use a Download Accelerator.
If possible, mirror the download.
![Tulum Mexico in Late Afternoon Light [Explore #1, THANK YOU] Tulum Mexico in Late Afternoon Light [Explore #1, THANK YOU]](http://static.flickr.com/5470/7235972310_8c25258da5_t.jpg)


[...] This is a follow-up to my post: Android: Zip download of Cupcake Android v1.5 source code [...]
yesssssssssssssss