Subbu Lakshmanan

Fastlane Setup in Ubuntu

The recipe for automating android app publishing: bitbucket + Teamcity + Fastlane + slack.

The recipe we follow at my work for automating android app publishing is bitbucket + Teamcity + Fastlane + slack.

Choosing Fastlane for automatic publishing mobile apps to the store is no wonder. It's the most preferred way to publish apps automatically.

We use TeamCity for CICD at our work, We looked at a few of the cloud solutions for CICD, but finally, we opted to use TeamCity Professional Version as our CICD tool. It's free to use and 3 build agents with 100 build configurations which were more than enough for our purposes. And comparatively, We felt it was way easier to set it up and configure than Jenkins.

Of course, Jenkins has been there for a while and may have more community support and plugins than TeamCity, TeamCity felt easy to manage without a dedicated person for support. We did play around several other CICDs but finally settled with TeamCity.

Fastlane is officially supported to run on macOS, and it seems like Windows & Linux Support is coming up.

Since our TeamCity server (& the in-built build agent) was running on Ubuntu 14.04, We needed to install Fastlane in the same machine. The installation instructions for Fastlane on Ubuntu 18.04 is easy to find in [comments of an issue](https://github.com/fastlane/fastlane/issues/11687# issuecomment-489891745).

Here are the installation steps for Ubuntu 18.04 from the comments.

  1. Install ruby and ruby-dev headers
sudo apt install ruby ruby-dev
  1. Set environment language variables. Add these lines to the top of ~/.profile
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
  1. Check that you didn't break the environment and restart. Run source ~/.profile in the terminal. If no output, you are safe. Otherwise, check for what you broke in the .profile file

  2. Install Fastlane

sudo gem install fastlane
which fastlane  // Verify
  1. From there do the normal Fastlane Setup

I ran into some issues while doing this setup. Some of the Gotchas while doing this.

  • Make sure to install Ruby 2.x version
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby2.4
ruby -v // Verify
sudo apt-get install ruby2.4-dev
  • Depends on your Ubuntu 14.04 environment, Sometimes the following needs to be installed
sudo apt-get install libc6-dev
sudo apt-get install g++
  • Fastlane uses the Google API client to communicate with the Google Play Console Services. I noticed this issue, 'Missing Google API Client' when installing Fastlane.
gem install google-api-client -v 0.29.1

That should be it, Hope that helps.

P.S: I wrote the draft of this blog a very long time ago and left it to pickle :D. I just decided to publish it after correcting the grammatical and misspelled words. Some of the errors may have been fixed.

This post is also available on DEV.

All rights reserved