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

Getting ReactAndroid:configureNdkBuildDebug Error when NewArch is Enabled #33742

Closed
SectionTN opened this issue May 2, 2022 · 43 comments
Closed
Labels
Platform: Android Android applications. Platform: Windows Building on Windows. Tech: Codegen Related to react-native-codegen Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@SectionTN
Copy link

New Version

0.68.1

Old Version

0.67.3

Build Target(s)

Android Debug

Output of react-native info

System:
OS: Windows 10 10.0.19044
CPU: (4) x64 Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz
Memory: 447.12 MB / 3.88 GB
Binaries:
Node: 16.15.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.5.5 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 30, 31, 32
Build Tools: 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0
Android NDK: 24.0.8215888
Windows SDK: Not Found
IDEs:
Android Studio: Not Found
Visual Studio: Not Found
Languages:
Java: 11.0.15 - C:\Program Files\Eclipse Adoptium\jdk-11.0.15.10-hotspot\bin\javac.EXE
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.1 => 0.68.1
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found

Issue and Reproduction Steps

My Issue:

I'm facing an error when buidling my react-native project, to be precisely, it's an ndk problem when NewArch is enabled, but when it's disabled, build success.

Error Log:

`> Task :ReactAndroid:configureNdkBuildDebug[arm64-v8a] FAILED
C/C++: C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid/../ReactCommon/butter/Android.mk:28: *** Android NDK: Aborting.
. Stop.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':ReactAndroid:configureNdkBuildDebug[arm64-v8a]'.

[CXX1405] error when building with ndkBuild using C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid\src\main\jni\react\jni\Android.mk: Build command failed.
Error while executing process C:\Users\Administrator\AppData\Local\Android\Sdk\ndk\23.1.7779620\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid\src\main\jni\react\jni\Android.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_LIBS_OUT=C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\2l523i4m/lib NDK_APPLICATION_MK=C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid/src/main/jni/Application.mk THIRD_PARTY_NDK_DIR=C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid\build\third-party-ndk REACT_COMMON_DIR=C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid/../ReactCommon REACT_GENERATED_SRC_DIR=C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid\build/generated/source REACT_SRC_DIR=C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid/src/main/java/com/facebook/react -j4 NDK_OUT=C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform.cxx NDK_APP_SHORT_COMMANDS=true APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
Android NDK: WARNING: Ignoring unknown import directory: C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid\build/generated/source
Android NDK: C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid/../ReactCommon/butter/Android.mk: Cannot find module with tag 'glog' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:

C:\Users\Administrator\Documents\GitHub\MoonMeet-CrossPlatform\node_modules\react-native\ReactAndroid/../ReactCommon/butter/Android.mk:28: *** Android NDK: Aborting. .
Stop.`

Attachments:

I've seen something like Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ? i did define it but still the same error

Screenshot (12)

Screenshot (13)

I can provide another files if recommended, Thanks React-Native Team!

@SectionTN SectionTN added Needs: Triage 🔍 Type: Upgrade Issue Issues reported from upgrade issue form labels May 2, 2022
@react-native-bot react-native-bot added the Platform: Android Android applications. label May 2, 2022
@SectionTN SectionTN changed the title Getting ReactAndroid:configureNdkBuildDebug when NewArch is Enabled Getting ReactAndroid:configureNdkBuildDebug Error when NewArch is Enabled May 2, 2022
@fortmarek
Copy link
Contributor

Hey @CortexTN 👋

You might try to check out these two PRs (#33682 and #33707) and patch your local React Native to see if that helps. Whenever those PRs are merged, we plan to release another patch release 0.68.2.

In the meantime, if you could also provide reproducible steps, that would be fabulous.

@mganandraj do you think this issue might be related to your PRs?

@SectionTN
Copy link
Author

Thanks for responding, I don't know how to reproduce steps for issues, but i clearly remember myself followed react native upgrade helper guide then i builded the app end up getting this error

@fortmarek
Copy link
Contributor

I recommend creating a new app with npx react-native init MySample --version 0.68.1 and trying to reproduce the issue there. Of course, it might not be always possible but it's worth trying.

@SectionTN
Copy link
Author

I'll try it and comeback to you ASAP

@SectionTN
Copy link
Author

SectionTN commented May 2, 2022

Hello again @fortmarek
I've downloaded the fresh react-native template (0.68.1) as you said, and i can now confirm that building a react native app with new arch is broken on windows, I haven't change anything on the template and i got an error like you mentioned above (Long Paths), i hope you guys fix build on windows, anyway build on windows with new arch disabled works well! (excuse me for my english)

@fortmarek
Copy link
Contributor

Thanks for getting back to us - the fix should be hopefully be merged soon 🙌 You can also try out the new 0.69.0-rc.0 where the approach has changed and the long paths should no longer be an issue.

@SectionTN
Copy link
Author

SectionTN commented May 2, 2022

Thanks for help sir, much appreciated, anyway i've saw both PRs (#33682 and #33707) and i patched my local react native, but still an error. i guess i did everything correctly.

@mganandraj
Copy link
Contributor

Hey @CortexTN 👋

You might try to check out these two PRs (#33682 and #33707) and patch your local React Native to see if that helps. Whenever those PRs are merged, we plan to release another patch release 0.68.2.

In the meantime, if you could also provide reproducible steps, that would be fabulous.

@mganandraj do you think this issue might be related to your PRs?

Yep, PR#33707 should fix the build on Windows boxes with reasonable application root path.. But, as long as we use NDK21, we are still prone to issues with long file paths if the root path is long (>15 chars)..
PR#33707 is currently blocked though because of complexities in bringing fixes to react-native-codegen package into stable branches.

@SectionTN
Copy link
Author

Hey @CortexTN 👋

You might try to check out these two PRs (#33682 and #33707) and patch your local React Native to see if that helps. Whenever those PRs are merged, we plan to release another patch release 0.68.2.

In the meantime, if you could also provide reproducible steps, that would be fabulous.

@mganandraj do you think this issue might be related to your PRs?

Yep, PR#33707 should fix the build on Windows boxes with reasonable application root path.. But, as long as we use NDK21, we are still prone to issues with long file paths if the root path is long (>15 chars)..
PR#33707 is currently blocked though because of complexities in bringing fixes to react-native-codegen package into stable branches.

I've tried patching my local react native with your changes and unfortunately it didn't work

@mganandraj
Copy link
Contributor

Hey @CortexTN 👋
You might try to check out these two PRs (#33682 and #33707) and patch your local React Native to see if that helps. Whenever those PRs are merged, we plan to release another patch release 0.68.2.
In the meantime, if you could also provide reproducible steps, that would be fabulous.
@mganandraj do you think this issue might be related to your PRs?

Yep, PR#33707 should fix the build on Windows boxes with reasonable application root path.. But, as long as we use NDK21, we are still prone to issues with long file paths if the root path is long (>15 chars)..
PR#33707 is currently blocked though because of complexities in bringing fixes to react-native-codegen package into stable branches.

I've tried patching my local react native with your changes and unfortunately it didn't work

Could you share the build logs ?

@SectionTN
Copy link
Author

Hey @CortexTN 👋
You might try to check out these two PRs (#33682 and #33707) and patch your local React Native to see if that helps. Whenever those PRs are merged, we plan to release another patch release 0.68.2.
In the meantime, if you could also provide reproducible steps, that would be fabulous.
@mganandraj do you think this issue might be related to your PRs?

Yep, PR#33707 should fix the build on Windows boxes with reasonable application root path.. But, as long as we use NDK21, we are still prone to issues with long file paths if the root path is long (>15 chars)..
PR#33707 is currently blocked though because of complexities in bringing fixes to react-native-codegen package into stable branches.

I've tried patching my local react native with your changes and unfortunately it didn't work

Could you share the build logs ?

sure but not now, I'm outside doing some businesses, I'll mention the build logs as soon i back home (i may stay 3 hours outside)

@SectionTN
Copy link
Author

Hey @mganandraj

This is the build log from gradle, i think that this what you meant by build log.
build.txt

@SectionTN
Copy link
Author

@fortmarek the 0.69 release candidate one have a problem with most dependencies, an error like
warn Package @react-native-firebase/app has been ignored because it contains invalid configuration. Reason: "dependency.platforms.ios.scriptPhases[0]" must be a string warn Package @react-native-firebase/crashlytics has been ignored because it contains invalid configuration. Reason: "dependency.platforms.ios.scriptPhases[0]" must be a string warn Package react-native-vector-icons has been ignored because it contains invalid configuration. Reason: "dependency.assets" is not allowed
and build failed because those dependencies are ignored, that's all.

@mganandraj
Copy link
Contributor

@CortexTN You root directory is very long : "C:/Users/Administrator/Documents/GitHub/MoonMeet-CrossPlatform/"

log file suggests the build is failing while setting up the gdbserver, even before the compilation starts. Could you try creating th e project directly under "c:". Also, use powershell for building, which supports longer command lines.

One more caveat: If you applied the changes in the above mentioned PR, make sure that you manually apply the changes in the android.mk in react-native-codegen.

@fortmarek
Copy link
Contributor

the 0.69 release candidate one have a problem with most dependencies, an error like

If you could provide some more details and post them here, somebody might be able to look into that 👍

@SectionTN
Copy link
Author

@CortexTN You root directory is very long : "C:/Users/Administrator/Documents/GitHub/MoonMeet-CrossPlatform/"

log file suggests the build is failing while setting up the gdbserver, even before the compilation starts. Could you try creating th e project directly under "c:". Also, use powershell for building, which supports longer command lines.

One more caveat: If you applied the changes in the above mentioned PR, make sure that you manually apply the changes in the android.mk in react-native-codegen.

Tried this, but didn't work (tried without patching my local react native, kinda lazy to do so)

@SectionTN
Copy link
Author

the 0.69 release candidate one have a problem with most dependencies, an error like

If you could provide some more details and post them here, somebody might be able to look into that 👍

sorry sir, already downgraded yesterday

@SectionTN
Copy link
Author

@CortexTN You root directory is very long : "C:/Users/Administrator/Documents/GitHub/MoonMeet-CrossPlatform/"

log file suggests the build is failing while setting up the gdbserver, even before the compilation starts. Could you try creating th e project directly under "c:". Also, use powershell for building, which supports longer command lines.

One more caveat: If you applied the changes in the above mentioned PR, make sure that you manually apply the changes in the android.mk in react-native-codegen.

Tried this, but didn't work (tried without patching my local react native, kinda lazy to do so)

I haven't found any Android.mk in react native codegen

@cortinico cortinico added Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) Platform: Windows Building on Windows. Tech: Codegen Related to react-native-codegen and removed Needs: Triage 🔍 Type: Upgrade Issue Issues reported from upgrade issue form labels May 3, 2022
@SectionTN
Copy link
Author

for now, I'll downgrade to 0.68.1 and build my app without the NewArch, it works well on windows, I'll wait for a stable fix like 0.68.2.

@cortinico
Copy link
Contributor

I'll wait for a stable fix like 0.68.2.

Yup we're still looking into how to build the New Architecture on Windows as the proposed fixes (i.e. #33707) haven't been confirmed yet.

@SectionTN
Copy link
Author

Yes with all respect to #33707 's owner, it doesn't fix my problem, anyway i'm using 0.68.1 on this open source project MoonMeet if you want to test changes or see if i did something wrong etc...

@mganandraj
Copy link
Contributor

@CortexTN Unfortunately, Applying #33707 is still required to reduce the file path lengths to below windows limits, even after shortening the root path .. Yeah, it doesn't sound great :( The longer term solution is to upgrade NDK to r22 which doesn't have this long file path limit (If configured so through Windows registry) but we are seeing some intermittent crashes with r23. We are working on sorting it out !

@SectionTN
Copy link
Author

@CortexTN Unfortunately, Applying #33707 is still required to reduce the file path lengths to below windows limits, even after shortening the root path .. Yeah, it doesn't sound great :( The longer term solution is to upgrade NDK to r22 which doesn't have this long file path limit (If configured so through Windows registry) but we are seeing some intermittent crashes with r23. We are working on sorting it out !

yeah i noticed the reduced file paths, but still some long paths, even trying all NDK versions (21, 23, 24, I think those are the correct NDK versions) and the PowerShell (both stock and 7.1 from Microsoft website), please mention me if you guys fix it!

@cortinico
Copy link
Contributor

please mention me if you guys fix it!

Yesterday I was able to test #33707 and verify that is effectively fixing the issue, with NDK 21 + I needed a new release of react-native-codegen (which is something we'll have to do on the release branch as well).

@SectionTN
Copy link
Author

Hello Again.
please tell me when you fix react native codegen and tell me the steps (i mean what files to patch and what to add exactly on my local react native)
Thanks y'all.

@SectionTN
Copy link
Author

Hello Everyone, is there any news expected soon ?

@fortmarek
Copy link
Contributor

The fix should be a part of the 0.68.2 release, so follow the Github releases and let us know if you no longer see the issue on that version once it's out 🙂

@SectionTN
Copy link
Author

Hello again, sorry for the delay, thank you for your work!

@fortmarek
Copy link
Contributor

@CortexTN have you been able to confirm that 0.68.2 works for you?

@SectionTN
Copy link
Author

didn't try it, i will try it later, I've been busy with some things outside, I'll comment and close this issue when i can confirm it works

@xy371661665
Copy link

xy371661665 commented May 11, 2022

@CortexTN have you been able to confirm that 0.68.2 works for you?

@fortmarek
Hello, I have a same problem with 0.68.2.
NDK version is 21.4.7075529

@SectionTN
Copy link
Author

@CortexTN have you been able to confirm that 0.68.2 works for you?

@fortmarek
Hello, I have a same problem with 0.68.2.
NDK version is 21.4.7075529

Hello, i didn't try it yet, still have some problems, i can't code at the moment, I'll try with different NDK version ASAP

@SectionTN
Copy link
Author

Hello again, i've been trying with different NDK Versions, and all failed on NDK build
here is some build logs:

NDK 21

NDK21.txt.txt

NDK 23

NDK23.txt.txt

NDK 24

NDK24.txt.txt

I hope you guys fix this ASAP, Thanks.

@fortmarek
Copy link
Contributor

@mganandraj are the persistent errors due to the current paths too long or is it indicative of the issue not being resolved?

@Elabar
Copy link

Elabar commented May 11, 2022

@CortexTN Can you try to build with Windows Power Shell?
I had errors with bash/cmd as well. (Not sure if it is the same errors as yours)
But I had success with Power Shell.

@SectionTN
Copy link
Author

@CortexTN Can you try to build with Windows Power Shell?
I had errors with bash/cmd as well. (Not sure if it is the same errors as yours)
But I had success with Power Shell.

VSCoduim default terminal use PowerShell

@SectionTN
Copy link
Author

@mganandraj are the persistent errors due to the current paths too long or is it indicative of the issue not being resolved?

i think the issue is not being resolved, please see the logs, I can't see long paths, but something called NDK_MODULE_PATH isn't resolved and searched directories are null (" ")

@SectionTN
Copy link
Author

hello again, great news, new arch works on windows with fresh project, the problem is with my project, I'll do some workaround to see what's the bug on my project, Thanks all for your work

@SectionTN
Copy link
Author

log.txt
getting this build log when trying to manage my project to work

@cortinico
Copy link
Contributor

Hey @CortexTN
I've just tested 0.68.2 on a fresh project on Windows, and I can confirm it builds and works correctly.

The error you're experiencing is most likely related to dirtly build folder.
I would suggest you to clean up the project and try re-building

@kelset
Copy link
Contributor

kelset commented May 12, 2022

hey folks, I just realised that this is technically a duplicate of #33528.
A few folks are also reporting there that 0.68.2 addresses the problem but only for fresh new apps. Let's close this and have the conversation progress there as it seems that now the ball is in the hands of the library maintainers to add new arch support.

@kelset kelset closed this as completed May 12, 2022
@linjson
Copy link

linjson commented May 19, 2022

0.68.2 NewArch of Android not work on Mac 11.6.5

Hey @CortexTN I've just tested 0.68.2 on a fresh project on Windows, and I can confirm it builds and works correctly.

The error you're experiencing is most likely related to dirtly build folder. I would suggest you to clean up the project and try re-building

@cortinico
Copy link
Contributor

0.68.2 NewArch of Android not work on Mac 11.6.5

This issue is about Windows, not Mac. Please open another issue.

@facebook facebook locked as resolved and limited conversation to collaborators May 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: Android Android applications. Platform: Windows Building on Windows. Tech: Codegen Related to react-native-codegen Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

9 participants