How to add Firebase App Distribution Admin role ?
Set up Firebase Service Credentials
Go to the Google Cloud Platform console → Select your project → Create a new service account.
Add the Firebase App Distribution Admin role, like so:

- Create a private JSON key and move the key to a location accessible to your build environment. Be sure to keep this file somewhere safe, as it grants administrator access to App Distribution in your Firebase project.

- Keep this file in the
root/fastlanedirectory of your project. (In this example, I’m keeping the name of this file as firebase_login_credentials.json)

Set up Test Groups
- Create a new file groups.txt in the fastlane directory.

- This means your application will be distributed to the rorty-android-test groups (these groups are created or managed in the App Distribution dashboard within the Firebase console).

Set up Fastlane
Setup config
before_all do
ENV["FIREBASE_LOGIN_CREDENTIALS"] = "fastlane/firebase_login_credentials.json"
ENV["FIREBASE_APP_ID"] = "1:11111111111111:android:2222222222222"
end
Final code example:
default_platform(:android)
platform :android do
before_all do
ENV["FIREBASE_LOGIN_CREDENTIALS"] = "fastlane/firebase_login_credentials.json"
ENV["FIREBASE_APP_ID"] = "1:111111111111:android:222222222"
end
######## FIREBASE DISTRIBUTION ########
desc "Submit a new Google Test Build to Firebase App Distribution"
lane :testGoogle do |options|
gradle(task: "clean")
gradle(task: "assemble", flavor: "Google", build_type: "Debug")
# find apk path
output_path = "./app/build/outputs/apk/google/debug/"
output_json_path = output_path + "output-metadata.json"
build_output = load_json(json_path: output_json_path)
elements = build_output["elements"][0]
apk_path = output_path + elements["outputFile"]
release_note_information = " BRANCH => #{git_branch} - developer: #{last_git_commit[:author]}"
release_note = "#{release_note_information} \n #{options[:r]}"
firebase_app_distribution(
app: ENV["FIREBASE_APP_ID"],
apk_path: apk_path,
release_notes: "#{release_note}",
groups_file: "fastlane/groups.txt",
service_credentials_file: ENV["FIREBASE_LOGIN_CREDENTIALS"]
)
# fastlane testGoogle r:"First Alpha Release"
end
end