Archive for May, 2009

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.

image 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!");

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.


There are currently three known sources to download the source code (21.6 mb).

Oh yes, download smart, use a Download Accelerator.

If possible, mirror the download.


Read Full Post »

image One major reason of Firefox’s success is due to its abundant of interesting and innovative extensions that improve upon FireFox’s capability to ways unimaginable. FireFox has to be the first popular browser that manages to attract the the developer community to voluntarily develop large number of free extensions which subsequently realize Marc Andreessen’s revelation about “browser as the operating system”. Users no longer prefer monolithic browser where they have to wait impatiently for next release for some cool features. Rather the users now prefer to use extensible browser like Firefox to allow them to be more productive and cool using wide range of free powerful extensions. This means no more waiting for cool features to be built because chance is that there is some extensions somewhere that able to do the job.

Fortunately, for developer who want to create cool extension, they can accelerate the development by learning and even reusing the source code of their favourite extensions. By and large, Firefox’s extensions is generally written in obfuscated JavaScript and bundle together with other files into a single container file with extension XPI. Unlike traditional Windows application where files are conveniently packaged into few “standardised” install files and extracted during installation, Firefox’s XPI extension is essentially a ZIP file that contains exactly the raw files of the extensions down to the directory structure.


Read Full Post »