Fastlane android building: missing


I am building an app bundle (.aab) for our react native app.

When I build via Android Studio, app builds, deploys to Play Store. I download and run – everything works.

When I build via FastLane, app builds, deploys to Play Store. But I download and run, I get the following error:

E AndroidRuntime: java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle '' is packaged correctly for release.
E AndroidRuntime:   at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
E AndroidRuntime:   at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(
E AndroidRuntime:   at com.facebook.react.bridge.JSBundleLoader$1.loadScript(
E AndroidRuntime:   at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(
W ActivityTaskManager:   Force finishing activity
RN: 0.63.4
Gradle: 4.1.1

FastLane Logs: appears to be correctly generated.

> Task :app:bundleDevReleaseJsAndAssets
warning: the transform cache was reset.
Welcome to React Native!
Learn once, write anywhere
info Writing bundle output to:, /home/runner/work/fridayapp-pax/fridayapp-pax/android/app/build/generated/assets/react/dev/release/
info Writing sourcemap output to:, /home/runner/work/fridayapp-pax/fridayapp-pax/android/app/build/generated/sourcemaps/react/dev/release/
info Done writing bundle output
info Done writing sourcemap output
info Copying 88 asset files
info Done copying assets

Task :app:mergeDevReleaseResources is run after Task :app:copyDevReleaseBundledJs


def getVersionCode
  # Instead of managing the version code manually it is simply based on a timestamp in sec
  # Any build done more recently is considered to be a higher version
  # versionCode increase every minute (aka max 1 build per minute)
  # versionCode can't be smaller than legacyVersionCode
  thirtySeptemberTwentyTwenty = 1601480940 / 60
  legacyVersionCode = 10902
  versionCode = legacyVersionCode + ( / 60) - thirtySeptemberTwentyTwenty

  if versionCode > 2100000000
    raise "versionCode cannot be higher than 2100000000"


platform :android do

  desc "Friday (Dev)"
  lane :playstoreDevInternal do |options|
    # Retrieve version of my app in package.json (React Native case)
    package = load_json(json_path: "../package.json")

    # Clean build folder
      task: "clean"

    # Bump android.defaultConfig.versionCode
    # bump_build_number
      version_code: package["versionName"]

    # Do the bundle of the application  
      # task: "assemble",
      task: 'bundle',
      flavor: "dev",
      build_type: "Release",
      properties: {
        "" => Dir.pwd + "/release.keystore",
        "" => options[:RELEASE_KEYSTORE_PASSWORD], # keystore password
        "android.injected.signing.key.alias" => options[:RELEASE_KEYSTORE_ALIAS], # alias
        "android.injected.signing.key.password" => options[:RELEASE_KEYSTORE_KEY_PASSWORD], # key password
        "vname" => package["version"]

    # Upload Android App Bundle to PlayStore like Internal testing Release
      package_name: '',
      track: 'internal',
      release_status: 'draft',
      skip_upload_apk: true,
      version_name: package["version"]

Can anyone point out why the aab bundle from Android Studio works, but not the one generated via FastLane? Even though is clearly generated.

My only thought is that perhaps the path is incorrect. But I don’t see a way of modifying that path.


Turns out that the gradle scripts were generating the bundle into a build variant-specific folder, but the app was looking for the bundle in the default location, regardless of the build variant:

Gradle script generated bundle location (Flavor: dev, Type: release):


App looking at location:


So I added a script to package.json to generate this:

"generate:bundle": "react-native bundle --platform android --dev false --bundle-output android/app/src/main/assets/ --entry-file index.js"

And prior to running the build command in my runner script, I run the script to generate the build:

npm run generate:build

The app now finds the bundle.

Answered By – HyderA

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published