In android/fastlane/Fastfile, replace everything with the following
platform :android do
desc "Deploy to closed beta track"
lane :closed_beta do
track: 'Closed beta',
NOTE: By default, when you set the track to beta, fastlane uploads your build to the Open beta testing track in Google Play Console. To create a custom and closed beta track named Closed beta, please follow the instructions here.
d. Configure Appfile
In android/fastlane/Appfile, add the path for the service_account_key.json
json_key_file("service_account_key.json") # Add this
Setup Android App
a. Generate a Service Account Key
Google Developers Service Account Key (a.k.a. Service Account Key) will be used for authenticating requests sent to the Google Play Developer API. Fastlane then establishes a connection to this API to publish your app to Google Play.
2 . In the Settings menu, select API access, then click CREATE SERVICE ACCOUNT
3 . Navigate to the provided Google Developers Console link in the dialog
4 . Click CREATE SERVICE ACCOUNT at the top of the Google Developers Console
5 . Provide the details required, then click CREATE
6 . Click Select a role, select Service Accounts, then click Service Account User
7 . In the Service Accounts dashboard, navigate to the Actions column, tap the menu for the service account that you created, then click Create Key
8 . Select JSON as the key type, then click SAVE
9 . Back on the Google Play Console, click DONE to close the dialog
10 . Click on Grant Access for the newly added service account
11 . Make sure that the role of this service account will have the permission upload builds
12 . Click ADD USER to close the dialog
b. Encrypt sensitive files
Encrypting files such as *.jks, key.properties, or the service account key adds additional layer of security to prevent any unauthorized access to view sensitive credentials or regain access to the services you use in your app.
This triggers the workflow to run and display its status on the pull request.
That’s it for your Flutter’s Android app.
Take note, the setup of jobs may vary depending on the tools or dependencies your project requires. For example, if it uses Firebase Cloud services, you might need to encrypt the google_services.json file as well.
It's a challenge to maintain Circle CI commands, jobs, workflows, and everything else in a single config.yml or config file. Luckily, there's an alternative way to make it more human-readable for the developer teams.