Skip to content

Cannot run Android release build when index.android.js not in main directory #11571

@dannycochran

Description

@dannycochran

Description

I recently upgraded to react-native 0.39.2 from 0.37, and my command to run a production build on the emulator no longer works.

react-native run-android --configuration Release --variant prod --root artifacts/lib

Fails with the error:

Cannot find entry file index.android.js in any of the roots: ["/Users/Documents/reactApp"]

I'm using Typescript to compile assets into an artifacts folder, such that my directory structure is:

  • reactApp
    • package.json
    • ios
    • android
      • gradle
      • ...
    • artifacts
      • lib
        • index.android.js
        • ...
      • ...
    • src
      • lib
        • index.android.ts
        • ...
      • ...

Reproduction

Have a directory structure similar to the one above where index.android.js is not in the main directory folder and run:
react-native run-android --configuration Release --variant prod

Solution

I believe this was caused by a pull request in 0.39, from @SandroMachado

2a2d3c6#diff-a003f89d34db18b4567fdb55080a003eR103

The react-native bundle command seems to assume the index.android.js exists in the root directory of a project, and no longer sets the process current directory to be the root arg passed in when running react-native run-android.

Additional Information

  • React Native version: 0.39.2
  • Platform: Android
  • Operating System: MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions