Nexus S on Windows 8 issue

I've got a bit outdated Nexus S phone and I decided to try it as test device for some Phonegap development. I had it updated with CyanogenMod for Nexus S (crespo) to Android 4.4.2 in less than one hour. But when tried to run Phonegap app on it, seem like Windows 8 has problem identifying the device (Ubuntu doesn't FTW!). The driver I've found on Samsung website didn't help, phone was listed as unknown device in Device manager. However, generic Google USB Driver that comes with Android SDK does the trick. Use 'Update driver' for unknown device in Windows' Device manager and point it to

[Android SDK folder]\sdk\extras\google\usb_driver\

to help Windows locate driver.

Nexus S Windows 8

After this, plug in Nexus S to USB, turn on USB Debugging, accept computer's key permanently (it will be prompted on phone). Check device to be properly found by SDK by issuing command:

>adb devices
List of devices attached
3232DCDC6699E0E0E0 device

Now the Nexus S device is ready for application development.

Starting Phonegap development: configuration and tools

Those familiar with Phonegap development know this awesome service: Adobe PhoneGap Build. It allows building for different platforms without having entire Phonegap infrastructure installed on developer's machine. However, some 'old-school' guys like me, prefer having everthing within reach on local machine. Here are some instructions to get up and running with Phonegap development for Android platform.

Prerequisites

System: Ubuntu 13.10 or Windows 7 or 8

IDE: Eclipse 3.8.1 or IDEA 13

Java: Oracle JDK 1.7.0_45

Download latest JDK from Oracle web site, untar it to destination of choice (I used /opt). Install alternatives like described in this article. Make sure it's working and Oracle JDK is default:

# java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

Android phone

Plug into USB and turn on development mode. For version 4.2 you have to tap About Phone -> Build number several times to activate Developer's menu, like described here. I'm also used CyanogenMod of Android 4.4. Turn on USB Debugging from Developer options.

Software

  • Download and Install ANT, just unzip to destination folder and add it to $PATH variable;
  • Download and install Android Development Kit - in fact you need only unzip it to destination folder. Add [ANDROID_SDK_FOLDER]/sdk/tools and /sdk/platform-tools to your $PATH variable;
  • Download and install node.js - just copy in destination folder and add path to [NODE_JS_FOLDER]/bin to your $PATH variable;
  • Install Phonegap package using Node Package Manager
# npm install -g phonegap
  • Then create Phonegap project. This will create HelloWorld package with default activity of HelloWorld in folder hello:
$ phonegap create hello

or in full form:

$ phonegap create hello com.example.hello HelloWorld

Eclipse

To develop and debug in Eclipse with ADT Plugin, or with ADT Bundle, start new project:

New project -> Android -> Android project from existing code

Point Eclipse to pick up phonegap-generated code. Make sure that both project and library files were picked up by Eclipse.

Then Run As -> Android Application

IDEA

Despite being favorite IDE for Android development at the moment, I've only found handful of instructions for running Phonegap project in IDEA. For time being, I'm editing HTML files from /www folder in IDEA (as Web project) and then sending to be installed to device via this command:

phonegap run android

This command is run from application folder, it will compile and install app on active development device.

Monads 101

Concepts of functional programming explained, very interesting for imperative language developer. Main idea I brought from the video is that we can control complexity of software and libraries, by having functions obey rules, allowing combine functions in library in safe way. Having small libraries of safely combinable functions keeps complexity under control.