-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot run Android release build when index.android.js not in main directory #11571
Comments
Use |
@SandroMachado sorry, my mistake. I am using --configuration. I was thinking the issue is on line 110 of local-cli/runAndroid/runAndroid.js -- the index.android.js entry file is always expected to be at the root directory, no? |
This is the command executed to generate the release So the problem is your |
correct, index.android.js is under artifacts/lib. when running in dev, I run two separate commands on two different terminal screens: screen 1: In production, I run:
But the artifacts/lib root isn't respected for the line you pasted above, line 110 of local-cli/runAndroid/runAndroid.js |
Yup, it is an issue. It is easy to fix, unfortunately that code is not on BTW, as a quick fix you can run the release command, directly, I pasted above and fix the directory. It should work.
/cc @grabbou |
dang. what would the fix look like? I hardcoded line 115 to look like this:
and that results in a new error that makes little sense to me:
|
Hum, can this be a memory (RAM) issue? In the past, developing for Android, I saw that kind of errors caused by insufficient memory. |
I'm guessing this is a separate issue from the one I originally posted, and may have to do with the fact that my app has a webview which loads various assets. When I run:
Five additional directories are created in android/app/src/main/res/:
The bundler also creates two files in android/app/src/main/assets/:
If I remove all these files right after they're created (git clean -f -d) by the bundle command, the app builds successfully on the emulator. If I don't remove them, I get the error above. |
this was fixed by 0.41.0 |
Thanks @dannycochran it's fixed in 0.41.0. This is the command executed to generate the release Bundle. react-native bundle --platform android --dev false --entry-file index.android.js \ --bundle-output ../android/app/src/main/assets/index.android.bundle --assets-dest ../android/app/src/main/res/ |
Case of my install i have modified the @sahir 's command to:
Now the bundle file is present. |
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:
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
The text was updated successfully, but these errors were encountered: