Fastlane for Android Developers
A quick way to automate gradle scripts when developing apps using android is using fastlane. while not the Most widely used tool in town it’s the new trend. With projects like flutter adopting it into their own documents and by extension Google.
Not only that, but the automation of delivery makes this tools super darn good.
in this short blog we shall create a script to build an app. And in the next one we might deliver that automatically to google play store in the form of a draft.
Preparing Fastlane
To start things off, we shall create in the root of our project a new file called Gemfile
, and inside that we add fastlane via
source "https://rubygems.org"
gem "fastlane"
Creating the scripts
We simply create a folder named Fastlane
and inside that folder we create a file named Fastfile
, in it we write:
default_platform(:android)
platform :android do
desc "Submit a new build to alpha Track on Play"
lane :alpha do
# We can create a debug
gradle(
gradle_path: "/usr/bin/gradle",
task: "assemble",
build_type: 'Debug'
)
# Or a profile APK
gradle(
gradle_path: "/usr/bin/gradle",
task: "assemble",
build_type: 'Profile'
)
# Or a release APK
gradle(
gradle_path: "/usr/bin/gradle",
task: "assemble",
build_type: 'Release'
)
end
end
And that’s all folks.