Wednesday, September 14, 2011

Starting from Scratch?

I recently visited a workshop that covered a certain library for Android development. To the surprise of anybody, the vast majority of the participants were highly interested in Android but hat neither written a line of Android code before nor had they any of the development tools installed. 

The instructor had foreseen that some people would need to install things and had anticipated the setup would take about 30 minutes. This estimate turned out to be overly optimistic, to say the least. Wifi problems, non-optimal internet connection, wildly diverging os configurations, participants' questions and the catatonic shock of some being exposed to the eclipse IDE for the first time - all this took some time. After 1,5 hours of the 2 hour workshop people were still struggling with their installations. 

In this spirit let's assume you start at zero, zilch, nothing. And you want to rock the world with your Android ADK development.  

First you will need some hardware:

A. A computer running a fairly recent version of Mac OSX, Linux or Windows

B. A compatible Android device - usually a smartphone with Android 2.3.4 or higher or a tablet with Android 3.1 or higher.  
This needs some word of caution. Many devices will work in USB accessory mode, but others will not. There are no guarantees; it depends on the hardware and firmware of the device. The Nexus One, Nexus S and Mortorola Xoom tablet have been confirmed to work, but its your responsibility to make sure your device supports the USB mode. The Android emulator will not 
work with the ADK. You can install and run your apps but they won't talk to the board.
C. An Android Open Accessory (ADK) compatible development board. Some are listed here
D. Some cables to connect A, B and C.

Then have some coffee and patience and:  

1. Check your system requirements

2. Set up your system for Android development

3. Prepare your device for development

Test 1: Follow the "Hello, World" tutorial and run it on your device
If this works, fine. This makes you an Android developer. 

5. Install the Arduino software and additional libraries
up to the sentence "You should now have three new directories in the Arduino libraries directory: AndroidAccessoryUSB_Host_Shield, andCapSense."
Additional to the instructions, I copied the firmware > demokit folder from the ADK to my Arduino directory. 

Test 2: Connect your ADK board and upload the "Examples > Basic > Blink" example
Does it blink? Now you are in for serious Arduino development. If you want to digress, try some Arduino examples from http://arduino.cc/en/Tutorial/HomePage

7. Transfer the ADK firmware to the board and continue on

Test 3: Run the DemoKit Android application on your Android andcontinue on
If you can control the ADK board from you Android: Congratulations. You just got ready to start developing with the ADK. 

Honestly, I would plan a full afternoon for this. It is necessary to make sure that each step works before moving on. If somebody should pay for this kind of stuff, I would even recommend doing a one day workshop explaining these very fundamental topics and the tools a bit. "Fundamental" derives from "fundament". I think self-help sites, especially stack overflow (http://stackoverflow.com/), have their value but I guess more than a third of the Android-related questions there are simply superfluous - the topics wouldn't be unclear if people would take their time studying the fundamentals a bit.
Back to Android Reads my Brain.