Tuesday, May 18, 2010

Installing Android development tools

Previous: Installing Oracle Express and ADF - FAIL!

Because Android development is supported by a special Eclipse plugin, I wanted to run a separate instance of Eclipse configured for Android development. I downloaded the basic (non JEE) version of Eclipse from http://www.eclipse.org/ unpacked it into my home directory using
tar xzvf eclip*
and renamed the resulting eclipse directory to .eclipse-android.

Next, I followed the instructions at http://developer.android.com/sdk/installing.html#Installing to install the Android SDK starter package. After downloading the package (in this case, the 64-bit Linux version), I unpacked it into my home directory with
tar xzvf android-sdk*
and renamed the resulting directory from android-sdk-linux_86 to .android-sdk.

The instructions suggest adding the tools subdirectory to PATH in .bash_profile or .bashrc. Because of the way I've got my startup files organized at the moment I'm setting PATH in .profile, so I defined it there by adding the line,
PATH=$PATH:~/.android-sdk/tools
Then I followed the instructions at http://developer.android.com/sdk/eclipse-adt.html to install the Android Development Tools (ADT) plugin for Eclipse.

I started Eclipse and created the workspace android-sandbox when prompted. Then I went to Help > Install New Software > Add... and entered this URL into the Location field:
https://dl-ssl.google.com/android/eclipse/
It seemed to take longer than these things usually take, but eventually Developer Tools appeared in the list of available software. Android DDMS and Android Development Tools came up, as per the instructions. I clicked Next, accepted the license agreement, and clicked Finish. After a fairly lengthy download process and a warning about installing unsigned content, the plugins seemed to install. When Eclipse restarted, I found Android Project and Android Test Project listed under New... > Other.... So far, so good.

Next, I told Eclipse where to find the Android SDK. In Window > Preferences > Android, I browsed to the .android-sdk directory and set that as the SDK location.

In a Terminal window, I started the ddms utility, went to File > Preferences... > Usage Stats and unchecked the checkbox for sending usage statistics to Google.

The instructions say you should use the "Android SDK and AVD Manager" to download at least one platform and any additional components you want. The real name of the program is android. I determined that by starting each of the executables in the tools directory one by one. Fortunately, android was only the second one in the alphabetical list! (Note: Later I noticed that Android SDK and AVD Manager is an option on Eclipse's Window menu.)

I chose Available Packages and the program populated the list. Being new to this, I wasn't too sure what I needed. I chose the documentation as well as the platform and API for Android 1.5, API 3, revision 3, and the samples. I clicked Install Selected, accepted the license agreement, and clicked Install. This started an insanely long download. I went to bed and let it run overnight.

The next morning I browsed through the SDK directory tree to see what had been installed. Then I followed the "Hello World" tutorial at http://developer.android.com/resources/tutorials/hello-world.html. The tutorial covers some of the basic setup you have to know about in order to develop Android apps, so I suggest following it if you're doing this for the first time. The tutorial assumes you're using Eclipse for development. If you're using a different development environment you'll have to work out how to take the equivalent setup steps.

The tutorial instructions were accurate and everything worked as documented.

There doesn't appear to be much documentation about TDD for Android apps, but there is some sample test code in the ApiDemo sample app. I think my next step in learning about Android development will be to work out a good way to do TDD, with this example as a starting point.

Next: sudo:must be setuid root

Tuesday, May 11, 2010

Installing Oracle Express and ADF - FAIL!

Previous: Renaming NTFS filesystem on external drive

The client for my next coaching engagement will be using Oracle's Application Development Framework (ADF). I thought it would be a good idea to familiarize myself with some of the tools they'll be using, so I went to Oracle's website to download single-user versions of tools that are available at no charge. Oracle Express provides all the basic functionality of the Oracle RDBMS and ADF is a Java-based webapp framework tailored for Oracle back ends.

While I appreciate Oracle's willingness to make these tools available, I must say I was a bit surprised at the difficulty of obtaining them. The servers appear to be extremely slow. The Oracle Express download is a few hundred megabytes, and it took several hours. The ADF download is about 1.5 GB, and it ran more than 12 hours. Downloads of other software, videos, music, etc. from other sources have been considerably faster on the same (hotel) wireless connection and using the same laptop.

Before starting the lengthy download of Oracle Express, I first had to reach the link and click on it. Normally, clicking on a link is a relatively routine operation on the Internet. Not so on this occasion. The download page for Oracle Express for Linux reported an error refreshing the browser, and advised me to contact the site administrator. Interesting advice, as there appears to be no way to contact a site administrator.

Oracle's webapp is the only suspect that had opportunity...not quite sure about motive, though. Then again, it may be a failure of logic on my part: The business motive to provide poor customer service has never been intuitively obvious to me. I can but trust the good folks at Oracle have sound reasons for it. After spending some time searching the website for a contact link or for an alternative way to obtain the software, I gave up and did a Google search for "oracle express linux download."

Of course, the official download page was the first hit. Google offered a link to a cached version of the page. I tried that and, lo and behold! the page appeared with all links working. The software was in fact right where it was supposed to be and was available, but there was (still is?) something wrong with the website; you just can't get to the appropriate page through the front door. Thanks to Google's cache, a side window was open. I slid through and downloaded the Debian package for the Western character set.

One positive aspect of Oracle's service is that they provide documentation. The first documented step to install Oracle Express was to run the following command:
dpkg -i oracle-xe_10.2.0.1-1.0_i386.deb
It turned out this has to be done as superuser, so I tried
sudo dpkg -i oracle-xe_10.2.0.1-1.0_i386.deb
This time, I got
package architecture (i386) does not match system (amd64)
There is no mention of a 64-bit version on Oracle's site, nor any warning that the package they offer is for 32-bit systems.

What is worse than "useless?" "Misleading."

I guess I'll have to learn these tools using the client's time and equipment. The cynic in me wants to say that's part and parcel of their having chosen Oracle as a vendor. The professional in me doesn't like to say it, and wishes companies would simply provide what they claim to provide, whether free or not, or else not make the claim at all. The consultant in me says nothing about it for the moment, but has filed the experience for future reference when clients ask for advice about vendor selection.

Next: Installing Android development tools