Mobile Fastlane

Initialize a project (init_project)

Last updated 2026-10-07

init_project is a one-time wizard that inspects your native projects and writes fastlane/config/environments.yml for you. Use it when you onboard a new app, or when you want to regenerate the configuration from scratch.

Before you begin

Step 1: Start the wizard

my-app — zsh
~/my-app $ bundle exec fastlane init_project
[10:12:03]: Starting Fastlane lane: init_project
[10:12:03]: --- Project setup ---
? App name [MyApp]:
? App identifier / package [com.example.myapp]:
? Organization [Default]: Example Inc.
Press Enter to accept a detected value shown in [brackets].

Defaults are detected from app.json, strings.xml, package.json, google-services.json and build.gradle.

Step 2: Choose environments and platforms

my-app — zsh
Default environments: development, staging, uat, production
? Environments (comma separated) [development,staging,uat,production]: development,staging,uat,production
? Default environment:
❯ development
? Enable Android? (y/n) y
? Enable iOS? (y/n) n

You can use any names, for example qa,preprod,production. Names are lower-cased and become the keys under android.environments and ios.environments.

Step 3: Configure each Android environment

The wizard reads productFlavors and buildTypes from Gradle (Groovy and Kotlin DSL). See Configure build variants for what these are. For each environment it suggests the matching flavor:

my-app — zsh
? Android project dir [android]:
Detected flavors: dev, staging, prod
--- Android · staging ---
? Flavor for staging:
❯ staging
? Build type for staging:
❯ release
? Default artifact for staging:
❯ AAB
? Distribute staging via Firebase App Distribution? (y/n) y

From those answers it derives the Gradle task and the output path. These follow the naming rules described in Build your app from the command line:

FlavorBuild typeArtifactgradle_taskartifact.glob
(none)releaseAPKassembleReleaseandroid/app/build/outputs/apk/release/*.apk
(none)releaseAABbundleReleaseandroid/app/build/outputs/bundle/release/*.aab
stagingreleaseAPKassembleStagingReleaseandroid/app/build/outputs/apk/staging/release/*.apk
stagingreleaseAABbundleStagingReleaseandroid/app/build/outputs/bundle/stagingRelease/*.aab

Step 4: Notifications and output

my-app — zsh
? Send Microsoft Teams notifications? (y/n) y
? Send Slack notifications? (y/n) n
[10:14:41]: Wrote /Users/you/my-app/fastlane/config/environments.yml
[10:14:41]: Added 9 key(s) to .env.example: FIREBASE_ANDROID_DEVELOPMENT_APP_ID, FIREBASE_ANDROID_DEVELOPMENT_GROUPS, ...
[10:14:41]: Next: fill .env, then run `fastlane android doctor` / `fastlane setup`.
[10:14:41]: Fastlane completed successfully: init_project

The generated file never contains secrets. App IDs and groups are written as ${FIREBASE_ANDROID_<ENV>_APP_ID} placeholders, which the loader resolves from .env or CI secrets at run time.

fastlane/config/environments.yml (excerpt)
android:
enabled: true
project_dir: android
use_flavors: true
environments:
staging:
description: Staging Android distribution
flavor: staging
build_type: release
gradle_task: bundleStagingRelease
artifact:
type: AAB
glob: android/app/build/outputs/bundle/stagingRelease/*.aab
firebase:
enabled: true
app_id: "${FIREBASE_ANDROID_STAGING_APP_ID}"
groups: "${FIREBASE_ANDROID_STAGING_GROUPS}"
testers: ''
app_testing:
enabled: false # AI tests need an APK
Caution: if environments.yml already exists, the wizard asks before replacing it and keeps a backup at environments.yml.bak. Hand-written comments are not carried over, so compare the two files before committing.
Note: init_project refuses to run in CI (CI=true), because it needs a person to answer.

Step 5: Validate

  1. 1

    Fill .env

    Copy the new keys from .env.example into .env and fill in the values (reference).
  2. 2

    Run doctor

    Shell
    bundle exec fastlane android doctor environment:staging

Official documentation

Was this helpful?