Why use a Build Service?

Building an executable is the last step before submitting your app to the Android or Apple stores. Why should it be the hardest?

George Henne
5 min readOct 4, 2020

You’ve got your web app working and you are ready to release it to your users and the app stores. There are two ways to package apps into apk files (for Android) and ipa files (for iOS): you can use Cordova to build them on your own system, or upload them to a Build Service (such as PhoneGap (now defunct), VoltBuilder, Ionic or Monaca.

Build Services aren’t free. You’ll need to spend a monthly fee, the amount of which depends on the features you need. On the other hand, installing, maintaining and using the Cordova toolchain can be a challenge — it can be more difficult than developing the app itself.

Difficulties installing Android toolchain

Cordova has documentation on installing the Android toolchain. Here is what needs to be installed.

  • JDK: Used to compile Java modules and to create keystores. Download from Oracle. You’ll need to sign up for an Oracle account to do so. Once installed, you have to set environment variables, which in most cases means editing system files with an editor. If you have other Java libraries installed, this can get a little messy.
  • Android Studio: Check how much disk space you have first: this is a big package (12 gigs on my system). They’ve improved the install experience a lot, but there are still a number of steps to go through. You’ll also need to set environment variables.
  • Android SDKs: Once Android Studio is installed, you can use its SDK Manager to install the additional tools and software needed to the Android API level you are targeting. (Last I checked, the Cordova docs are not up to date on this part)
  • Gradle is next. You may want to use SDKMAN! or Homebrew to help with the installation. Yes, environment variables need to be set here too.
  • Environment Variables and PATHs: Yes, I’ve mentioned these already. Once everything is installed, it’s time to see if everything is correct. (It never is for me!)
  • Node.js: This is required to install the Cordova CLI. You should be able to invoke node and npm from the command line. You may want to use a package manager to install it.
  • Cordova-CLI: Now we can finally install this. It will give us the command line tool we need to run Cordova commands.

You’re finally ready to build Android apps, providing everything has gone smoothly.

A Build Service will have all these components already installed and properly configured. You actually won’t even notice they are there: the Build Service will wrap them into the interface so you do not need to interact directly with them.

Difficulties installing Xcode toolchain

Cordova has documentation on installing the iOS toolchain. It’s easier than Android: just about everything gets installed with Xcode. Of course, you will need a Mac running a fairly recent version of Mac OS. It also helps to have a fairly powerful Mac with an SSD: we’ve seen 5 to 10x speed increase in builds by using faster hardware.

  • Xcode: This is big. As of XCode 14.2.1, it weighs in over 16 gigs. It’s actually easy to install: it is included in Apple’s App Store as a single download. Remember to start it just after installation to install the rest of the command line tools.
  • CocoaPods: This is a dependency manager for Swift and Objective-C Cocoa projects. Not all projects require it, but sooner or later, you will probably need it. It gets installed as a Gem with Ruby, which you will have install if you do not have already. It’s important to keep this one up to date: dependancies are constantly changing.
  • Node.js: This is required to install the Cordova CLI. You should be able to invoke node and npm from the command line. You may want to use a package manager to install it.
  • Cordova-CLI: Now we can finally install this. It will give us the command line tool we will need to run Cordova commands.

You’re finally ready to build iOS apps, providing everything has gone smoothly.

As with Android, a Build Service will have all these components already installed and properly configured. You actually won’t even notice they are there: the Build Service will wrap them into the service so you do not need to interact directly with them.

Difficulties maintaining toolchains

  • There are a lot of vendors here: You’ve probably noticed there are components here from almost a dozen different companies.
  • There are a lot of updates: The mobile development environment is evolving quickly. All of these tools get regular updates. You’ll need to make sure they are in sync (for example, a new version of Xcode may require an update to MacOS).
  • There is no easy way to find out if one of the tools is out of date. You can either check each tool regularly for updates, or wait for something to break. There is no easy way to check them all for updates.
  • Something is always out of date: If you build new versions of your app a month or more apart, you can be sure one of the components needs an update.
  • Updating one often breaks others in the chain: New versions often change environment variables or paths. There are also version dependancies which need to be respected.

If you’re building locally, be ready to spend time whenever you have a new build. The longer between builds, the more complex the update will be. The Build Service companies are (or should be!) constantly updating their toolchain so it’s always ready to use when you need to make a build.

Learning Curve

Now that you have everything installed, you have to learn how to use it. The documentation for Cordova is pretty good, but there are still a number of commands to learn. You’ll need to create the app, add platforms, add your plugins, merges, certificates and resources. There is a complete reference to all the commands and their options.

Build Services will offer many of the same options, but will let you set a lot of these options in config and json files. Since they take care of performing the actual Cordova commands as part of the service, there is less to learn.

Reading Error Messages

Once you’ve done a build, and everything goes smoothly, you’ll get an apk or ipa file. This is software development, so you won’t be surprised when that doesn’t work out. Cordova produces detailed log files for each command. When a command fails, you’ll need to read the log files to see what went wrong and to correct it.

Log files for an iOS build often have a meg of output and over 3000 lines of text. You’ll have to dig through those lines to find out what went wrong. Android builds are not much better.

A good Build Service will have a tool to analyze the log and look for errors, reporting only what the actual problem was (and perhaps even suggesting a solution), as well as making the actual log available.

Conclusion

While using Cordova CLI is an effective way to build locally, it’s not for everybody. Making builds is a complex process which requires continual maintenance. If you’re in a hurry to get an app out, or want to keep your life a bit simpler, use a Build Service.

George Henne is a member of the VoltBuilder team. He has worked with PhoneGap and Cordova for over a decade. When it was clear that PhoneGap was no longer being maintained, he helped build a modern replacement for it. Apache Cordova is a great piece of software: VoltBuilder is a wrapper which makes it easier to use.

--

--