What’s an APK?
An APK stands for Android Package Kit. It is the file containing an app on android. We publish APK files to the market and customers download on their phones and tablets to install our app.
Why 60 APKs?
We have 15 apps now, each with their own APK –
- Kids Shapes
- Kindergarten Math
- Kindergarten Math Lite
- Kids Phonics
- Kids Phonics Lite
- Kindergarten Word Play
- Kindergarten Word Play Lite
- Kids Measurement Science
- Kids Measurement Science Lite
- First Grade Math
- First Grade Math Lite
- First Grade Word Play
- First Grade Word Play Lite
- Second Grade Math
- Second Grade Math Lite.
We publish the apps to 3 markets so far. For each market, we have to build its own APK. Most of the code is the same. The difference is in the market links that the app contains to review or buy the apps. For Amazon, the link from the app goes to amazon market place. For google, it goes to google play store, for nook – it goes to nook store.
We are planning to add another market – Nokia, for the Nokia X series of Android phones to be released next week. So, that’s a fourth market.
15 apps to be published to 4 markets – 15 X 4 – gives us 60 APKs.
How much time did it take?
I used to build each of the apks by hand. I was typically only releasing one project at a time, and three apks built using export wizards was not that big a deal. When adding the Nokia market, I am building all the apks for Nokia. Also, since there was some releases planned, I was also building half the apps for all the other markets. It would take a day to build all the apks by clicking buttons on a wizard. Not only that, the process was error prone – did I change that directory name, or, did I accidentally export the amazon build into the nokia directory.
How did it get down to 15 minutes?
Android supports ant builds. It is not the newest or greatest means of doing builds, but, it works. Put the android provided build.xml in the project directory. Write a few customizations to switch the market links in custom_rules.xml. The hooks are already in the provided bulid file. Put the properties to sign the apk in a property file. And you can build the project using the command line.
I also wrote a custom master build – again using ant – that invokes each of the builds for each of the markets. It moves the apk over to the release directory to the correct market as well. Only step left is for me to smoke test the final build and upload it to the market.
It is easier to add new markets too. Add a new definition for the market links. Add the new market to the master build. Sit back, drink tea, and write this blog, while the build runs.
We use the build to switch markets. Mike had suggested that we should use libraries instead. The main project would be a library, and the final project will import the library and customize for the market. That would result in 60 projects! It is too much for me to track, but, it might work better for a bigger team to have the project divided into libraries.
Conor wanted me to use Gradle instead of Ant. I looked at doing that, but, the android directory structure was different for Gradle than what is created by the android eclipse plugin. This late in the game, it is too much work to switch it. But, I would look at it for future projects.
What a time-saver! I should’ve done it a long time ago. 2 days to write and test the build – saves a day over and over again.
Next, I should automate the smoke testing…. hmmm. Any suggestions?