-
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
[Windows] Gradle release build fails when spaces are in directory path #34878
Comments
Can you share your full build log? |
Here you are:
|
Bumping this - any updates? I feel like this should be an easy thing to fix, but I'm not familiar with Gradle (which is where I believe the problem lies. |
Nope it's not an easy fix. The problem is that it's failing inside the React Native CLI, most likely inside Metro. But I can't tell exactly from your stacktrace. |
Gotcha. Thanks for your response. I look forward to this being solved in the future! |
I'm also having the same issue. |
Apparently this isn't high priority, even though it fully breaks RN on any modern Windows machine (since Windows Setup automatically creates a home folder with a space in it. The only solution is to create a new folder somewhere like |
I understand that this is frustrating for you @micahlt but in this case there is a viable workaround which is the one suggested (also I can totally recommend to take the source code in your source root as Windows is not doing great at handling long paths). We have several other bugs/build issues on Windows that are not having a workaround. Feel free to send a PR or do some investigation for this issue, it will be really appreciated. |
Sorry if that comment sounded passive-agressive! I've already gotten my project to work in another folder on my machine. Just clarifying to @sandisahdewo that this issue isn't high priority. Thanks for your response to this issue! |
Thank you for posting this @micahlt... I almost give up on learning react native... changing the folder name works for me |
You're welcome! Best of luck with your continued learning. Hopefully someone will resolve this in the RN codebase soon! |
Also I'm happy to review a PR if someone has some spare time to look into this 👍 |
I'm working on a fix. You can assign this to me. |
@micahlt could you give it a try with 0.71.0-rc3 and check if this issue is resolved? |
Hopefully I'll have time to test it. I tried upgrading from 0.70.6 to 0.71.0-rc.3 with |
@micahlt can you try on a fresh new project first? |
Can confirm that a fresh project compiles and runs correctly! 🎉 |
Whoops - looks like I spoke too soon. I just ran |
ok, reopening for now until we get some confirmation that release also works |
I suspect that's a bug somewhere inside how we pass paths to metro. Can you share the full build log? |
Output of
|
I suspect the bug is here: Line 92 in 76bf71e
The path of |
I'll attempt to do this. However, doesn't that mean the project won't have access to Hermes' performance improvements? |
I think Nicola just want to verify that his suspicion is correct, not that it is a work around for you to use :) |
Yeah essentially this, as I don't have a Windows machine and I need one to reproduce/fix this bug. |
Gotcha, thanks for clarifying! I'll see if that fixes the issue. |
@cortinico Your suspicions are correct. Setting |
I'll get back to this on Monday when I'll have access to my Windows machine to fix it. |
I've spent some time on this and I'm not able to find a simple solution. We would need to properly escape the path for Windows only. This seems to be non trivial with Gradle. As this is happening only on Windows and only on Hermes and only inside folders that have a space in the path, I think this is not a release blocker (for .71). I have the suspect this was broken even before. |
@cortinico, @kelset, @shivenmian is working on a fix .. |
Hey, thanks for looking into this! Just to confirm the short-term work around for this is too disable Hermes or move the project to a path that has no spaces? Any further updates/developments on this? |
haven't heard back from @shivenmian - I'll ping internally |
I have a fix for this issue - will send a PR today. |
Until the fix is merged, yes - moving the project to a location without spaces (I used C:\Users\Public\Documents) will fix the issue. |
…36076) Summary: For Android release builds on Windows, gradle release build fails if there are spaces in path (facebook#34878). This is due to gradle improperly handling arguments with spaces (this is also [an open issue](gradle/gradle#6072) on Gradle). Since the Hermes compilation and other Gradle exec invocations involve arguments which will contain spaces (if there are spaces in your path), this also means it is hard to get around this by simply escaping the spaces (eg: by using double quotes), since these arguments are not properly handled by Gradle itself. As a workaround, this PR uses relative paths for all Gradle commands invoked for Android. As long as there aren't any spaces in the react-native directory structure (i.e this repo), this fix should work. ## Changelog [Android][Fixed] - Used relative paths for gradle commands Pull Request resolved: facebook#36076 Test Plan: `npx react-native run-android` builds and runs the app successfully on Android device, when run inside an RN0711 project with a path containing spaces (and with the changes in this PR applied) on Windows. This includes release builds (i.e with the `--variant=release` flag). Reviewed By: cipolleschi Differential Revision: D43080177 Pulled By: cortinico fbshipit-source-id: d245b2e92e1bd4cde8f12cdb2789913bdfee70a9
Summary: Pull Request resolved: #36080 For Android release builds on Windows, gradle release build fails if there are spaces in path (#34878). This is due to gradle improperly handling arguments with spaces (this is also [an open issue](gradle/gradle#6072) on Gradle). Since the Hermes compilation and other Gradle exec invocations involve arguments which will contain spaces (if there are spaces in your path), this also means it is hard to get around this by simply escaping the spaces (eg: by using double quotes), since these arguments are not properly handled by Gradle itself. As a workaround, this PR uses relative paths for all Gradle commands invoked for Android. As long as there aren't any spaces in the react-native directory structure (i.e this repo), this fix should work. ## Changelog [Android][Fixed] - Used relative paths for gradle commands Pull Request resolved: #36076 Test Plan: `npx react-native run-android` builds and runs the app successfully on Android device, when run inside an RN0711 project with a path containing spaces (and with the changes in this PR applied) on Windows. This includes release builds (i.e with the `--variant=release` flag). Reviewed By: cipolleschi Differential Revision: D43080177 Pulled By: cortinico fbshipit-source-id: 7625f3502af47e9b28c6fc7dfe1459d7c7f1362d
This has been fixed by @shivenmian here: We'll ship it in the next version or point release for 0.71 👍 |
Summary: Pull Request resolved: #36080 For Android release builds on Windows, gradle release build fails if there are spaces in path (#34878). This is due to gradle improperly handling arguments with spaces (this is also [an open issue](gradle/gradle#6072) on Gradle). Since the Hermes compilation and other Gradle exec invocations involve arguments which will contain spaces (if there are spaces in your path), this also means it is hard to get around this by simply escaping the spaces (eg: by using double quotes), since these arguments are not properly handled by Gradle itself. As a workaround, this PR uses relative paths for all Gradle commands invoked for Android. As long as there aren't any spaces in the react-native directory structure (i.e this repo), this fix should work. ## Changelog [Android][Fixed] - Used relative paths for gradle commands Pull Request resolved: #36076 Test Plan: `npx react-native run-android` builds and runs the app successfully on Android device, when run inside an RN0711 project with a path containing spaces (and with the changes in this PR applied) on Windows. This includes release builds (i.e with the `--variant=release` flag). Reviewed By: cipolleschi Differential Revision: D43080177 Pulled By: cortinico fbshipit-source-id: 7625f3502af47e9b28c6fc7dfe1459d7c7f1362d
…36080) Summary: Pull Request resolved: facebook#36080 For Android release builds on Windows, gradle release build fails if there are spaces in path (facebook#34878). This is due to gradle improperly handling arguments with spaces (this is also [an open issue](gradle/gradle#6072) on Gradle). Since the Hermes compilation and other Gradle exec invocations involve arguments which will contain spaces (if there are spaces in your path), this also means it is hard to get around this by simply escaping the spaces (eg: by using double quotes), since these arguments are not properly handled by Gradle itself. As a workaround, this PR uses relative paths for all Gradle commands invoked for Android. As long as there aren't any spaces in the react-native directory structure (i.e this repo), this fix should work. ## Changelog [Android][Fixed] - Used relative paths for gradle commands Pull Request resolved: facebook#36076 Test Plan: `npx react-native run-android` builds and runs the app successfully on Android device, when run inside an RN0711 project with a path containing spaces (and with the changes in this PR applied) on Windows. This includes release builds (i.e with the `--variant=release` flag). Reviewed By: cipolleschi Differential Revision: D43080177 Pulled By: cortinico fbshipit-source-id: 7625f3502af47e9b28c6fc7dfe1459d7c7f1362d
Description
I'm on Windows. When building my app for release in Android Studio, I receive the following error after Metro successfully generates the assets:
The path of the repository is
C:\Users\Micah Lindley\Documents\Code\repo
. This appears to be an issue with switching over to Hermes as Android Studio says it's tied to this line:react-native/react.gradle
Line 286 in 36c9716
Help on this is much appreciated, since this prevents my app from being built!
Version
0.70.2
Output of
npx react-native info
System:
OS: Windows 10 10.0.22621
CPU: (16) x64 AMD Ryzen 9 5900HX with Radeon Graphics
Memory: 14.97 GB / 31.41 GB
Binaries:
Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-212.5712.43.2112.8512546
Visual Studio: Not Found
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Snack, code example, screenshot, or link to a repository
https://github.com/micahlt/wasteofmobile/tree/reactnative
The text was updated successfully, but these errors were encountered: