Problem:

Most automated build servers don’t play well with mobile apps. Even after considerable configuration they still require a lot of up work for each new app.

Solution:

A friend of mine recently introduced me to Bitrise.io, an automated build server specifically built for mobile (Android, iOS & Xamarin). I’m happy to say that I was up and running in less than 30 minutes. With set up complete, adding a second project took just minutes.

Why do you need a build server?

Build servers are very useful and help ensure the stability of your codebase. If you’re code doesn’t compile or you forgot to check in a necessary resource to version control, your build server will notify you that something is wrong. Build servers also allow you to automate builds for QA and will keep a record of release builds. Still not convinced? Check out this blog.

Adding Your First Android Project to Bitrise.io

You can easily hook Bitrise.io up to your existing GitHub or Bitbucket account. If you host your own Git server, setup is as simple as adding an SSH key to your authorized_keys file.

Repo Setup

After you’ve added the SSH key as a new line to your authorized_keys file, select the branch you want to use. Select a stable branch that builds successfully on your local machine.

Repo Setup

I ran into a hiccup at this point. The project I added was one that I created almost a year ago. The gradle wrapper was too old to work with Bitrise.io and the error was a bit cryptic.

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
   > Gradle version 2.2 is required. Current version is 2.10.
     If using the gradle wrapper, try editing the distributionUrl
     in /bitrise/src/gradle/wrapper/gradle-wrapper.properties to
     gradle-2.2-all.zip

I was using version 2.2.1 and the current version is 2.8 so I’m not sure what the numbers in the error actually represent. A quick Stack Overflow search yielded the following result.

The solution

Update your graddle-wrapper.properties file:

distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip

I also updated to gradle 1.5 in my build.gradle file for good measure:

classpath ‘com.android.tools.build:gradle:1.2.3′
classpath ‘com.android.tools.build:gradle:1.5.0′

After checking in the code, everything compiled successfully! My ScoreKeeper app for Android Wear is now set up on Bitrise.io.