Build Distribution

Upload React Native iOS and Android builds to Sentry for distribution to internal teams and beta testers.

Build Distribution helps you securely distribute iOS and Android builds to your internal teams and beta testers. Streamline your distribution workflow with automated uploads from CI.

Accepted Formats: XCArchive

Upload Mechanisms: Fastlane Plugin or Sentry CLI

The Fastlane plugin can be used to upload XCArchive or IPA builds to Sentry. On GitHub Actions, Fastlane will automatically detect your build's metadata and include it in the upload. In other Continuous Integration (CI) environments, you may need to manually set metadata values.

  1. Configure the Sentry Fastlane plugin (version 1.36.0):

    Copied
    bundle exec fastlane add_plugin fastlane-plugin-sentry
    
  2. Set up SENTRY_AUTH_TOKEN in your environment (you can generate a token here)

  3. In FastFile, add a call to sentry_upload_build after your build step:

    Fastfile
    Copied
    lane :upload_to_sentry do
       build_ios_app(
         scheme: 'YourScheme',
         configuration: 'Release',
       )
       sentry_upload_build(
         org_slug: 'your-org',
         project_slug: 'your-project',
         build_configuration: 'Release' # Adjust to your configuration
       )
    end
    
  4. After an upload has successfully processed, confirm the metadata is correct in the Sentry UI

The Fastlane plugin automatically detects all build metadata. If needed, the metadata values can be overridden by passing parameters to sentry_upload_build:

Fastfile
Copied
lane :upload_to_sentry do
  build_ios_app(
    scheme: 'YourScheme',
    configuration: 'Release',
  )
  sentry_upload_build(
    org_slug: 'your-org',
    project_slug: 'your-project',
    build_configuration: 'Release',
    # Optional metadata overrides:
    head_sha: 'abc123',
    base_sha: 'def456',
    vcs_provider: 'github',
    head_repo_name: 'organization/repository',
    base_repo_name: 'organization/repository',
    head_ref: 'feature-branch',
    base_ref: 'main',
    pr_number: '42'
  )
end

See the Fastlane repo for more information.

  1. Install the sentry-cli (version 3.1.0)

  2. Authenticate the Sentry CLI by following these steps

  3. Build your app to create an XCArchive (preferred) or IPA

  4. Invoke the following CLI command to trigger the upload:

    Copied
    sentry-cli build upload app.xcarchive \
      --org your-org \
      --project your-project \
      --build-configuration Release
    
  5. After an upload has successfully processed, confirm the metadata is correct in the Sentry UI

Accepted Formats: APK (preferred) | AAB

  • APK: Distributed as uploaded. You must ensure uploaded APKs are properly signed and universal (if required) before uploading. Using a consistent signing key allows users to update previously installed builds.
  • AAB (Android App Bundle): Build Distribution automatically converts AABs to universal APKs, but signs each upload with a unique key, which prevents users from updating previously installed builds.

Upload Mechanisms: Gradle | Sentry CLI

The Gradle plugin automatically detects build metadata from your git repository. On GitHub Actions, all metadata is automatically detected. On other CI systems, you may need to manually set some values using the vcsInfo extension.

  1. Configure the Sentry Android Gradle plugin with at least version 6.0.0-rc.1
  2. Set the auth token as an environment variable to be used when running your release build.

    Copied
    export SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
  3. Enable uploading for distribution for CI builds.

    build.gradle.kts
    Copied
    sentry {
      distribution {
        enabled = providers.environmentVariable("GITHUB_ACTIONS").isPresent
      }
    }
  4. Invoke the following Gradle tasks to build your app and trigger the upload.

    aab
    Copied
    ./gradlew bundleRelease
  5. After an upload has successfully processed, confirm the metadata is correct in the Sentry UI

    Upload metadata

Overriding Metadata

The Gradle plugin automatically detects build metadata from your git repository. On GitHub Actions, all metadata is automatically detected. On other CI systems, you may need to manually set some values using the vcsInfo extension.

Configure overrides in your Gradle build configuration:

build.gradle.kts
Copied
sentry {
  distribution {
    enabled = providers.environmentVariable("GITHUB_ACTIONS").isPresent
  }

  vcsInfo {
    headSha.set("abc123")
    baseSha.set("def456")
    vcsProvider.set("github")
    headRepoName.set("organization/repository")
    baseRepoName.set("organization/repository")
    headRef.set("feature-branch")
    baseRef.set("main")
    prNumber.set(42)
  }
}

Available vcsInfo properties:

PropertyTypeDescription
headShaStringCurrent commit SHA
baseShaStringBase commit SHA (for comparison)
vcsProviderStringVCS provider (e.g., "github")
headRepoNameStringRepository name (org/repo format)
baseRepoNameStringBase repository name
headRefStringBranch or tag name
baseRefStringBase branch name
prNumberIntPull request number

  1. Install the sentry-cli (version 3.1.0)

  2. Authenticate the Sentry CLI by following these steps

  3. Build your app to create an AAB (preferred) or APK

  4. Invoke the following CLI command to trigger the upload:

    Copied
    sentry-cli build upload app.aab \
      --org your-org \
      --project your-project \
      --build-configuration Release
    
  5. After an upload has successfully processed, confirm the metadata is correct in the Sentry UI

Once builds are uploaded to Sentry, your team members and beta testers can download them through the Sentry web interface.

  1. Open the URL printed to the console after uploading the build
  2. Click the Install button on the right side of the page

  1. Either scan the QR code from a mobile device or click the Download button to download the build directly

After downloading, you can install the build directly on your iOS device. For more information on installing enterprise apps, see Apple's documentation on installing custom apps.

After downloading, you can install the APK directly on your Android device. You'll need to enable installing apps from unknown sources:

  • Android 8.0 and higher: Navigate to the Install unknown apps system settings screen to enable app installations from your browser or file manager.
  • Android 7.1.1 and lower: Enable the Unknown sources setting in Settings > Security.

For more information, see Android's documentation on unknown sources.

We use build metadata to organize builds in the UI and ensure correct comparisons.

FieldDescription
org*Sentry organization slug
project*Sentry project slug
build-configuration*Build configuration describing how the app was built, for example Release or Debug or Release-Bazel
head-shaCurrent commit SHA
base-shaBase commit SHA (for comparisons, recommended to use the branch's merge-base)
head-repo-nameRepository name (org/repo)
pr-numberPull request number
head-refBranch or tag name
base-refBase branch name

* required field

Build configuration metadata keeps comparisons scoped to like-for-like builds. The Android Gradle plugin sends the build variant (for example, freeDebug or paidRelease). On iOS, set this to your Xcode build configuration, such as Debug, Staging, or Release.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").