Build and distributeAndroid
Last updated 2026-10-07
Run the Android lanes through Bundler from the project root. Start with doctor: it catches configuration mistakes in seconds, before a multi-minute Gradle build.
- 1
Validates config, Gradle wrapper, Gradle task, artifact type, Firebase app id/groups/credentials and AI test setup.bundle exec fastlane android doctor environment:stagingmy-app — zsh~/my-app $ bundle exec fastlane android doctor environment:staging[14:47:49]: --- Android Distribution Doctor ---[14:48:03]: Flavor mode: disabled[14:48:03]: Firebase App Testing Agent: ENABLED (1 test case ID(s) configured, devices: model=a54x,version=34,...)[14:48:03]: Android staging configuration is valid. - 2
Prints the resolved configuration. Secrets are never printed.bundle exec fastlane android info environment:stagingmy-app — zsh~/my-app $ bundle exec fastlane android info environment:staging[14:48:03]: --- Android Distribution Information ---Project: MyAppEnvironment: stagingProject directory: /Users/you/my-app/androidFlavor mode: falseGradle task: assembleReleaseArtifact type: APKArtifact glob: android/app/build/outputs/apk/release/*.apkFirebase enabled: trueFirebase App Testing Agent: ENABLED - 3
Runs the Gradle build, finds the artifact and copies it tobundle exec fastlane android build environment:stagingdist/under a readable name.my-app — zsh~/my-app $ bundle exec fastlane android build environment:staging[14:02:11]: --- Android Build — STAGING ---[14:02:11]: Gradle project: /Users/you/my-app/android[14:02:11]: Gradle task: assembleRelease[14:06:40]: BUILD SUCCESSFUL in 4m 29s[14:06:41]: Android build completed.[14:06:41]: Artifact: dist/MyApp-staging-v1.4.0-57.apk - 4
The full pipeline (see How it works).bundle exec fastlane android distribute environment:staging
Shortcuts and options
| Option / lane | Effect |
|---|---|
android development | staging | uat | production | Shortcut for distribute environment:<name> |
environment:<name> | Selects the environment (default: APP_ENV, then project.default_environment) |
gradle_flags:"--stacktrace" | Overrides android.build.gradle_options for one run |
Shell
bundle exec fastlane android stagingbundle exec fastlane android distribute environment:staging gradle_flags:"--stacktrace"Tip: prefer menus?
bundle exec fastlane setup (see the setup wizard) asks for the environment, flavor and APK/AAB, then runs these same lanes.Official documentation
Was this helpful?