React Native (TypeScript / Hermes)
React Native apps combine a JavaScript/TypeScript bundle compiled with Hermes and native code in android/ and ios/. Fastlane handles compiling native binaries, injecting JS bundles, and uploading Hermes crash symbolication files.
flowchart LR
JS["Metro / Hermes (Bundle JS & Hermes Bytecode)"] --> Native["Compile Native Code (Gradle / Xcode)"]
Native --> Symbols["Hermes dSYM / ProGuard Mapping Generation"]
Symbols --> Dist["Deploy to Play Store & TestFlight"]
Directory Setup
Initialize Fastlane in both the android/ and ios/ subdirectories:
# In your React Native project root:cd android && bundle exec fastlane initcd ../ios && bundle exec fastlane init1. Android Lane: Gradle & ProGuard Mappings
In React Native, Hermes bytecode symbols and ProGuard mappings are crucial for crash symbolication:
# android/fastlane/Fastfiledefault_platform(:android)
platform :android do desc "Build React Native Android AppBundle and upload to Play Store" lane :beta do |options| # Clean previous builds gradle(task: "clean")
# Compile bundleRelease gradle( task: "bundle", build_type: "Release" )
# Locate generated mapping file and AAB mapping_path = "app/build/outputs/mapping/release/mapping.txt" aab_path = "app/build/outputs/bundle/release/app-release.aab"
upload_to_play_store( aab: aab_path, mapping_paths: [mapping_path], track: options[:track] || "internal" ) endend2. iOS Lane: CocoaPods, Hermes dSYMs & TestFlight
In React Native iOS, CocoaPods must be resolved before invoking build_app, and Hermes dSYMs must be included:
# ios/fastlane/Fastfiledefault_platform(:ios)
platform :ios do before_all do # 1. Ensure CocoaPods are installed cocoapods( clean_install: false, podfile: "./Podfile" ) end
desc "Archive and upload React Native iOS to TestFlight" lane :beta do match(type: "appstore", readonly: is_ci)
# Compile IPA using gym build_app( workspace: "YourApp.xcworkspace", scheme: "YourApp", export_method: "app-store" )
# Upload to TestFlight with dSYMs (including Hermes dSYM) upload_to_testflight( skip_waiting_for_build_processing: true ) endendCommon React Native Pitfalls
- Metro Bundler Cache: If you see stale JavaScript inside your production build, execute
npm run build:android -- --reset-cacheor delete theandroid/app/builddirectory prior togradle. - Missing CocoaPods: Running
cocoapodsaction inbefore_allprevents build failures caused by newly installed native npm modules. - Hermes Symbolication: Ensure
upload_to_testflightor your Crashlytics/Sentry action uploadsActions.lane_context[SharedValues::DSYM_OUTPUT_PATH]. Hermes produces separate dSYM files inside Xcode’s DerivedData.