Skip to content
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

React Native Android Build Issues 15.9.0+ #16046

Closed
enchorb opened this issue Apr 2, 2023 · 7 comments
Closed

React Native Android Build Issues 15.9.0+ #16046

enchorb opened this issue Apr 2, 2023 · 7 comments
Labels

Comments

@enchorb
Copy link

enchorb commented Apr 2, 2023

Current Behavior

Android apps have weird build issues on versions above 15.8.9.

First the variant/mode is ignored, by mode for @nrwl/react-native:run-android is devDebug but for whatever reason on versions above 15.8.9 it defaults to prodDebug which causes the build to fail (expecting a different signing config)

For the sake of testing what would happen if the prodDebug build completed (temp changed the signing config), I am then met with the below error

Not sure if this is due to the react-native-community/cli upgrade in 15.9.0 or some other issue but they do seem related

error isAssetFile is not a function
TypeError: isAssetFile is not a function
at resolveFile (//node_modules/@nrwl/react-native/node_modules/metro-resolver/src/resolve.js:272:7)
at resolveFileOrDir (//node_modules/@nrwl/react-native/node_modules/metro-resolver/src/resolve.js:198:22)
at resolveModulePath (//node_modules/@nrwl/react-native/node_modules/metro-resolver/src/resolve.js:130:18)
at Object.resolve (//node_modules/@nrwl/react-native/node_modules/metro-resolver/src/resolve.js:37:12)
at tsconfigPathsResolver (//node_modules/@nrwl/react-native/plugins/metro-resolver.js:84:30)
at //node_modules/@nrwl/react-native/plugins/metro-resolver.js:26:13
at Object.resolve (//node_modules/metro-resolver/src/resolve.js:50:12)
at ModuleResolver.resolveDependency (//node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:79:31)
at DependencyGraph.resolveDependency (//node_modules/metro/src/node-haste/DependencyGraph.js:271:43)
at Object.resolve (//node_modules/metro/src/lib/transformHelpers.js:171:21)

Expected Behavior

App builds, this is fine on versions 15.8.9 and below

GitHub Repo

No response

Steps to Reproduce

  1. Build android app on 15.9.2

Nx Report

All versions on 15.9.2

Failure Logs

No response

Additional Information

No response

@enchorb enchorb changed the title Nrwl Metro, isAssetFile Error React Native Android Build Issues 15.9.0+ Apr 2, 2023
@enchorb
Copy link
Author

enchorb commented Apr 2, 2023

Issue with the wrong variant still exists.

However have discovered the isAssetFile issue is because metro 0.76.0 removed it https://github.com/facebook/metro/releases. My orgs local version was 0.76.0 whereas I assume Nx is not on that yet so we rolled back to 0.75.1 and it is working fine again

@AgentEnder AgentEnder added the scope: react-native Issues relating to React Native label Apr 3, 2023
@omniviewsports
Copy link

@enchorb - I am having the same issue as you. I tried changing the metro dependencies in my package.json to 0.75.1 per your note above, but I still encountered the same build issue with android. Additionally, I noticed that regardless of the version of metro included in my package.json, when I run nx :start, metro 0.73.9 is what starts. I've tried adding metro 0.75.1 in the resolutions section of my package.json, which does cause metro 0.75.1 to start rather than 0.73.9, but android still fails. Any suggestions?

@xiongemi
Copy link
Collaborator

i think maybe downgrade metro to 0.73.9 since it is the react native peer deps version

@ste7en
Copy link
Contributor

ste7en commented Apr 26, 2023

The variant/mode is ignored from RN CLI's run-android in version 10.2.0, that is declared as dependency of react-native 0.71.7, when using the --list-devices or --deviceId <string>.

Until a version bump of CLI or stable release of 0.72 (which uses version 12.0.0 of react-native CLI), a fix would be to set the run-android executor option "listDevices": false and let the CLI choose the emulator to launch.

I pointed the issue here facebook/react-native#37110 and it the 0.71.8 thread

@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@Sameer-Ijaz
Copy link

@enchorb - I am having the same issue as you. I tried changing the metro dependencies in my package.json to 0.75.1 per your note above, but I still encountered the same build issue with android. Additionally, I noticed that regardless of the version of metro included in my package.json, when I run nx :start, metro 0.73.9 is what starts. I've tried adding metro 0.75.1 in the resolutions section of my package.json, which does cause metro 0.75.1 to start rather than 0.73.9, but android still fails. Any suggestions?

Were you able to solve the issue?

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants