Overview
The Fastlane is the automated tool for the entire app store deployment process.
Fastlane has following capabilities :
- Make a repeatable custom work process to build, upload and distribute new releases to the play store.
- Upload and deal with the greater part of your application’s metadata including screen captures.
- Automatically submit new versions of your application for review.
Topics
- Introduction
- How to install fastlane
- Setup the fastlane for the Project
- What is the supply in fastlane?
- Collect your Google Credentials from Google Play Console
- Make Configuration for Fastlane
- Environment variable setup
- Configure build.gradle for creating Release Apk
- Fetch your App Metadata from Google Play Console
- Deploy your application on Google Play Store
Introduction
Fastlane helps developers by publishing/uploading an app along with all the necessary details with just a few commands. But before having this advantage, we need to set it up with the app.
In this part of the series, I’ll explain the core functionality of Fastlane, starting right from it’s installation process
How to install fastlane
Open the terminal and run the following command for installation.
sudo gem install fastlane -NV
Now reach at the project directory in which you have to install the fastlane for that particular project.
Setup the fastlane for the Project
Setup the Fastlane for the particular project by executing the following command from inside the specific project folder.
fastlane init
- Please enter the package name for your application when asked. (Ex. com.yudiz.example)
- Enter the path for the json secret file for that application access. For more information please click here.
- Press ‘N’ when asked if you plan on uploading info to Google Play Store via fastlane.
Now you can able to watch the fastlane folder inside the project with configuration as on the base of your provided information.
Now you can find the two files inside the fastlane configured folder.
- Appfile -> which will define the global configuration information to your app.
- Fastfile -> which will define the ‘lanes’ that drive the behavior of fastlane.
What is the supply in fastlane?
Supply is a fastlane tool that transfers application metadata, screenshots and binaries to Google Play Developer Console.
Collect your Google Credentials from Google Play Developer Console
Now you have to download the .json credentials file from google developer console for uploading the application using the fastlane. Click here for detailed document
Make Configuration for Fastlane
Go into your project folder then open the fastlane > Appfile. Now change the path for the json_key_file and save them.
json_key_file ("Enter your json file path here")
Environment variable setup
Fastlane requires some condition factors set up to run effectively. Specifically, having your locale not set to an UTF-8 locale will cause issues with building and uploading your assemble.
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
Configure build.gradle for creating Release Apk
We have to configure of release apk keystore, alias and password in the build.gradle file for generating the release apk using fastlane.
android { signingConfigs { config { keyAlias 'Add Your Key Alias' keyPassword 'Enter Key Password' storeFile file('/Users/yudiz/Documents/keystore.jks') //Change with your path storePassword 'Enter Password' } } }
defaultConfig { signingConfig signingConfigs.config }
Fetch your App Metadata from Google Play Console
In the event that your application has been made on the Google Play Developer Console, you’re prepared to begin utilizing supply to manage it! Run:
fastlane supply init
Now all of your Google Play Store Application metadata is downloaded at fastlane supply init.
Because of confinements of the Google Play API, supply can’t download screenshots or videos.
Deploy your application on Google Play Store
Now you have to add the fastlane plugin for incrementing the version code and you have to create the lane for the supply of the application on the play store.
Add the following code in your ./fastlane/Fastfile.
platform :android do before_all do # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..." increment_version_code end desc "Submit a new debug Build" lane :debug do gradle(task: "assembleDebug") end desc "Submit a new Beta Build to Crashlytics Beta" lane :beta do gradle(task: "clean assembleRelease") supply(track: 'beta') end desc "Create a new version to the Google Play" lane :deploy do gradle( task: 'assemble', build_type: 'Release' ) supply end # You can define as many lanes as you want after_all do |lane| # This block is called, only if the executed lane was successful # slack( # message: "Successfully deployed new App Update." # ) end end
Now run the command for installing the fastlane plugin for incrementing the version code of apk in the terminal and if they ask to add it in Gem file then press Y. You have to add only once for each project.
fastlane add_plugin increment_version_code
After installing the plugin now run the fastlane deploy command for the deployment process or run the fastlane beta command if you want to deploy it in the beta version.
Its Done.