Unable to load script

I successfully built android app and it also runs on emulator after ‘yarn android’ but after downloading the apk and trying to run it in the device the following message appears:

if I press “RELOAD” then the following message appears:

please help

the build id is
2793d057-72d0-4dbf-89e3-b49e18182671

eas.json:

{
  "builds": {
    "android": {
      "release": {
        "workflow": "generic",
        "withoutCredentials": true,
        "gradleCommand": ":app:assembleDebug",
        "artifactPath": "android/app/build/outputs/apk/debug/app-debug.apk"
      }
    },
    "ios": {
      "release": {
        "workflow": "generic"
      }
    }
  }
}

why are you using assembleDebug? that depends on there being a metro server available. the default, if you don’t override the command, is assembleRelease

I don’t that’s the issue.

I also tried with

{
  "builds": {
    "android": {
      "release": {
        "workflow": "generic"
      }
    },
    "ios": {
      "release": {
        "workflow": "generic"
      }
    }
  }
}

and with

{
  "builds": {
    "android": {
      "release": {
        "workflow": "generic",
        "distribution": "internal",
        "gradleCommand": ":app:assembleRelease",
        "artifactPath": "android/app/build/outputs/apk/debug/app-debug.apk"
      }
    },
    "ios": {
      "release": {
        "workflow": "generic"
      }
    }
  }
}

update:

  • I re-created the project (with the managed workflow)
  • upgraded to sdk 41
  • made sure it runs on emulator and simulator
  • ejected (carefully followed all the steps)
  • managed to create a build successfully with “yarn android”
  • configured eas (to generate the eas.json file)
  • then changed the eas.json to this (since I wanted a downloadable link of apk):
{
  "builds": {
    "android": {
      "release": {
        "workflow": "generic",
        "distribution": "internal",
        "gradleCommand": ":app:assembleRelease",
        "artifactPath":"android/app/build/outputs/apk/debug/app-debug.apk",
        "cache": {
          "key" : "20042021_1"
        }
      }
    },
    "ios": {
      "release": {
        "workflow": "generic"
      }
    }
  }
}

after all that I ran and again successfully created the EAS Build, but the result is sadly still the same.

build id:
8c9bf5f3-fcb0-499e-b88d-d3ae746ae714

please help…

can you send me a link to your build page? it seems like also maybe your project is misconfigured and it’s never loading from the embedded bundle. try running npx react-native run-android --variant release in your project, without any metro instance open, and you’re likely to see the same error

of course.
https://expo.io/accounts/cyberserve/builds/8c9bf5f3-fcb0-499e-b88d-d3ae746ae714
logs:
https://expo.io/accounts/cyberserve/builds/8c9bf5f3-fcb0-499e-b88d-d3ae746ae714/logs

I tried

npx react-native run-android --variant release

and indeed failed with the following:

FAILURE: Build failed with an exception.

* What went wrong:
Task 'installRelease' not found in project ':app'. Some candidates are: 'uninstallRelease'.

* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 13s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installRelease -PreactNativeDevServerPort=8081

UPDATE

I managed to solve the problem (thanks to this solution) and reproduce a release build locally after running:

npx react-native run-android --variant release

I tried then to build using eas and failed with the following error:

872 actionable tasks: 872 executed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compressReleaseAssets'.
> Multiple task action failures occurred:
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CompressAssetsWorkAction
      > Entry name 'assets/app.config' collided
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CompressAssetsWorkAction
      > Entry name 'assets/app.manifest' collided
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CompressAssetsWorkAction
      > Entry name 'assets/index.android.bundle' collided
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CompressAssetsWorkAction
      > Entry name 'assets/ula.kml' collided
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4m 29s