Sunday, November 27, 2011

Obtaining Android Source Code on Microsoft Windows Platform

I was able to obtain the Android source code.

Here's a screenshot in Eclipse of what prompted me to go searching for the Android source code.

(really ugly when you try control-clicking on an Android API class only to get this)

Obtaining the source was MUCH more of a challenge than I expected, and took me several hours yesterday evening (plus an overnight download). Somehow I just imagined that the source would be available by Android API version as a ZIP or JAR file. Nope ...

In order to get it installed on Windows (which is officially not supported per the Android Open Source Project documentation), here's what I had to do:

  1. Install Cygwin. I installed Cygwin 1.7.9-1, the latest, obtained from
  2. The setup.exe is a Web Installer. I specified C:\cygwin as my Root Directory, installed for All Users. When running setup.exe, administrator privileges are required.
  3. In the Cygwin Setup - Select Packages dialog, I found packages for curl, git, and python. These 3 will be necessary for obtaining the Android Source. This installation was a bit tricky, so I want to document this well here:

Cygwin - curl installation

Cygwin - git installation

Cygwin - Python installation

  1. From here, complete installation of Cygwin.
  2. Once Cygwin has been installed, create a local directory to hold the Android Source. In my case, I used C:\android\android-source.
  3. Open a Cygwin terminal session and type:
    cd /cygdrive/c/android/android-source
    (of course, using whatever path for your local directory).
  4. Now, type:
    curl > ~/repo
    This will pull down the repo Python script used by the Android SDK Team and place it in your local directory for Android Source.
  5. Next, type:

    repo init -u

    This will create a .repo file and initialize the directory to hold the Android Source.
  6. Finally, type:
    repo sync

    This will do the actual downloading of the Android Source. It takes a long time, and pulled down 8.72 GB into my local working directory.

Saturday, November 26, 2011

Setting up Android Development Environment

I am going to be doing my Android Development on a Windows 7 environment. This has already proven to present a unique set of challenges, especially regarding obtaining Android source for the android.jar.

Thus far, here are the steps I have taken for setting up my dev environment:

  1. Download Java SDK 6. I always install this to C:\java\jdk1.6.0_29
  2. Download Eclipse Indigo (Eclipse 3.7.1), 32 bit. I download the "Eclipse IDE for Java EE Developers" version and unzip this (no installer) to C:\eclipse.
  3. Download Tortoise SVN 1.7.1. Figured I will need this for source/version control. I *should* switch to git at some point. However, I use Subversion at work, and did not feel like struggling with learning a new distributed version control system at this point in time (already plenty of new stuff to learn).
  4. Installed Android SDK R15 (Windows Installer). I installed this to C:\android\android-sdk and ran the Android SDK Manager.

  5. I installed everything for Android 4.0 (Ice Cream Sandwich), Android 3.2 (Honeycomb), and Android 2.3.3 (Gingerbread). This took quite some time.
  6. Install Eclipse plugin for Subclipse 1.8 (compiled against SVN 1.7)

  7. Install Eclipse plugin for ADT (Android Development Tools)

From here, I began to create a "Hello World" Application. However, as I did so, I realized that the android source was not available.

Obtaining the Android source for android.jar was quite an adventure that I'll write about in my next post.

Hello, Android

Over the Thanksgiving break, I upgraded my JDK to Java SDK 6 update 29 (I've been living in JDK 5-land for quite some time), pulled down Eclipse Indigo, and installed the Android SDK and the ADT Plugin for Eclipse.

At this point in time, I don't actually own any Android devices, yet I'm interested in getting into Android development.

I actually own 4 iOS devices (2 iPhone 4s, 2 iPad 2s). I was interested in iOS development and perused articles and books on Objective C, Cocoa, and even higher-level frameworks such as cocos2d and Corona SDK.

However, as much as I love my iOS devices, I just found it really difficult to get into iOS Development.

I've been doing Java Development for the past 12+ years. Although I think I'm fairly good at learning new languages and environments (I am comfortably able to hop between the Java and Microsoft .NET realms), I just found that there was a steep learning curve for Objective C and Cocoa.

When I first began getting into .NET development about 7 years ago, I found that C# was an easy transition for a Java developer. The .NET BCL provides many of the same classes for I/O, XML, Strings, and i18n as is provided by the core Java API. Thus, as a Java programmer in a new land, it didn't feel too horrendously foreign.

iOS development, on the other hand, felt like a completely different world.

There are definitely points in the article where my thoughts and philosophies regarding technology trends diverge from that of the author.

However, I found myself definitely relating to his points regarding the barriers to entry for iOS development, both in terms of knowledge and equipment, as well as the lack of transferability of skills developed in the iOS arena back to the world of writing enterprise business applications (he referenced the TIOBE Software Index, which in 11/2011 shows Objective-C has a Community Index Rating of 5.983% as compared to Java at 17.874%).

So, based on the fact that Android development fits with my Java / Eclipse background extremely well, I'm embarking on learning as much as I can during Thanksgiving break, and during subsequent evenings and weekends.