Zero to Google Play Store in a weekend
I recently set myself a challenge in order to learn about more about Android platform development; get an Android application from concept to Google Play Store in a weekend. Here is how I did it and a few of the things I learnt along the way.
The idea behind the application is simple, so simple its not surprising I have not found anything similar - an application that asks for a password, stores it in memory then allows you to pick the number of a character in the password and displays that character. It’s scratching an itch for me personally, there are a few websites that ask for the Nth character of a password so I usually end up trying to work it out or writing it down - this application just saves you having to do that.The purpose of this exercise is not to come up with a ground breaking new application, just to produce and release a non-trivial application on Android to learn about the SDK and Google Play a bit.
I know how important it is to do iteration zero tasks in the beginning so I made sure I did these things as soon as possible in the project. The first task was to pick an IDE, Google’s Android Studio seemed ideal and is based on the excellent IntelliJ IDEA but it is currently version 0.2.x and was missing a few features suggesting its a bit too early to use in anger so fell back to trusty old Eclipse and the ADT plugin. It may crash a lot but generally works OK.Another iteration zero job was dependency management and build tools, Google say they are moving away from ant based build tools to Gradle and I saw no reason to skip this. My project may have been pretty slim on the tools required now but you never know what can happen and this is stuff you do before writing any code.Finally; testing - this was an important goal of the project, I would suggest it is almost pointless knowing how to build an application, web, mobile, whatever if you do not know how to how to test it - test it as quick as possible and with minimum effort. I needed to know how to use some frameworks to run automated tests against the application; black box testing - ensuring the functionality is correct without manual effort.There are several tools available after a quick search:- Android automation tools - seemed to require a bit too much boilerplate code to get tests going
- Robotium - Good; simplified using the tools above
- Calabash - awesome looking BDD framework, write cucumber features and test them
After a couple of plays I decided to stick with Robotium along with the ubiquitous Junit, it did just enough with minimal set up.The key point here is; without unit and functional/integration testing you cannot achieve the velocity I was aiming for. Imagine if after every change I had to manually test everything - even on this simplistic app it sounds painful.
I made a design decision to keep as much of the logic away from Android libraries so that I could unit test it easily, Android activities, fragments, etc are just presentation and frankly this is the way it should be - I have seen too many cases of controller level components knowing and doing too much. My domain layer has as much of the logic as possible and was done TDD; I didn’t really know what I wanted everything to do having only come up with the concept half an hour earlier so letting the design unfold using TDD was useful. At this point I had not done any Android developing except set up the projects, I was missing out.Once I did get into the world of Android I again tried to follow TDD principles of ensuring I had a test failing before implementing the code to pass the test. I found wiring up activities and fragments fairly simple and even liked the layout xml files, the ability to configure a layout in code was just like html and css and seemed more geeky than drag and drop on a canvas (I’m looking at you Xcode!).However, this was not easy - similar to my html and css skills the hardest part of the whole project was adding ‘style’ to the whole project (and you could argue that it is still lacking in this department!). But the beauty of having automated tests is that I could tweak with the UI and ensure the functionality was still there.
This was probably the easiest step; I just self signed the APK and uploaded to Google Play Store (after parting with $25) with no messing with certificates, provisioning and distribution profiles like iOS - very simple and very straightforward. Google Play also has the excellent Alpha, Beta and Production environments allowing you to publish to a known group of testers - I don’t think this replaces systems such as Testflight but could be a vital pre-production test.
So, If you read the above paragraph then you could assume I had some involvment with the Play Store and completed the challenge? Yes and no; I mention the staging environments above because that is as far as I made it. Through the techniques I mention above I produced a functionally sound application but I could not make it look good enough in time so I released the ‘unstyled’ build version 0.3.0 to the Alpha environment just to complete the challenge! I have since added some sort of design and its in the Play Store - checkout the before and after - don’t ask “which is which?”.
If you’re interested then the application is downloadable from the Play Store or checkout the website.
- Do iteration zero, pre-development tasks up front
- Design application so as much domain logic is outside Android libs and unit testable
- Use an automated testing framework from day one
- Read Google’s reference documentation - I found this source easier than some other out-dated tutorials