Android App With Jenkins

I just got involved with a mobile project, and let my inner devop out for a moment… So, here’s how I got Jenkins to build, sign, and deploy an Android app for testing.

Our setup:

  • Jenkins CI, installed on a virtual Ubuntu server,
  • Android SDK on the Ubuntu server,
  • Android SDK compoments (including an Android profile/ target),
  • an Android project
  • keytool on Ubuntu to create a simple keystore, for signing the app

The gist of the Jenkins job is:

  • Get updated code from Git
  • Execute shell command to create an ant build file on the fly with the Android SDK tool android:
/opt/android-sdk/tools/android create project -n [name of resulting app file] -t [Android target] -p [name of temporary directory where project is copied and ant files generated] -k [package] -a [default app class]
  • Copy resulting build.xml from the temporary directory to the project root
  • Run ant targets clean release, with the following properties:
sdk.dir=/opt/android-sdk
target=[Android target]
key.store=path-to-keystore
key.alias=[alias]
key.store.password=[pw]
key.alias.password=[pw2]
  • (Without the last four properties above the job will build an unsigned app)
  • Publish resulting .apk via FTP to a server
And on my phone:
  • Allow installing apps from unknown sources

I got useful info from an article on jenkins-ci.org:  Getting started: Building Android apps with Hudson. My needs were a bit simpler, so you’ll see a bit more details there than here.

A few problems I had:

  • The Ubuntu VM didn’t have X installed, and getting SDK components seems to require a GUI. I tried to go around this by copying tools and targets from SDK on my laptop.
  • A bit later I got stumped by an error message on aapt and “no such file or directory”. (This might have been related to what I did on the previous problem…) An answer on stackoverflow regarding ia32-libs provided the solution in my case.

This project is a side project with low activity compared to a day job, so right now this job is a one-click deploy job (one click plus downloading and installing on the phone…) However, I think we’ll set up nightly polling, so there’s an updated app available every morning for testers, and they can see by the timestamp  if there were any updates the previous day.

Case Study on Lean-Kanban in BBC

David Joyce and Dr Peter Middleton have studied the application of (what I call) Lean-Kanban in BBC.

From the abstract:

The evidence shows that over the 12-month period, lead time to deliver software improved by 37%, consistency of delivery rose by 47%, and defects reported by customers fell 24%.

The significance of this work is showing that the use of lean methods including visual management, team-based problem solving, smaller batch sizes, and statistical process control can improve software development.
….

The faster delivery with a focus on creating the highest value to the customer also reduced both technical and market risks.

There’s more info on David’s blog, and you can also read the case study itself prior to publication from there.

Update: The case study was published in 2012.

What’s In a Kanban Standup?

First and foremost:

Focus on work items, not people.

Then:

Finishing is more important than starting.

Practical tip: start to the right/ at the end of your board, and identify impediments to finishing tasks as you go upstream on the board.

Only two questions are really necessary in the actual standup if the team’s real process is reflected on the board:

 The team will be asked if the board accurately reflects what is being worked upon. The team will be asked if there is anything that is slowing down or stopping throughput. After these two questions are answered by the team, the stand-up is over.

(Karl Scotland via @dpjoyce.)

Update: a few more reading tips.