Skip to content
Latchkey

fastlane gym "Error building the application" in CI

gym (build_app) wraps xcodebuild archive and export. When the wrapped xcodebuild fails, gym reports "Error building the application" but the real cause is in the xcodebuild log it printed just above.

What this error means

fastlane gym/build_app fails with "Error building the application - see the log above" after an xcodebuild archive step that exited non-zero.

fastlane
[!] Error building the application - see the log above

** ARCHIVE FAILED **

Common causes

The wrapped xcodebuild archive failed

A signing error, a compile error, or a failing script phase made xcodebuild exit non-zero, and gym reports its own summary on top.

Wrong scheme, workspace, or export options

gym was pointed at the wrong scheme or project, or given export options that do not match the available signing assets.

How to fix it

Read the xcodebuild log above gym's summary

  1. Scroll up to the xcodebuild output that precedes gym's message.
  2. Find the first real error (signing, compile, or script phase).
  3. Fix that root cause; gym's message clears once xcodebuild succeeds.

Pass explicit scheme and export options to gym

Make the build deterministic by naming the workspace, scheme, and export method.

Fastfile
build_app(
  workspace: "App.xcworkspace",
  scheme: "App",
  export_method: "app-store"
)

How to prevent it

  • Resolve the underlying xcodebuild error, not gym's wrapper message.
  • Pin scheme, workspace, and export_method in the Fastfile.
  • Run xcodebuild directly to debug, then re-enable gym.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →