Description
Instruction for building from source not working: https://facebook.github.io/react-native/docs/building-from-source. The error I got as below:
Error
> Task :ReactAndroid:buildReactNdkLib FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
73 actionable tasks: 3 executed, 70 up-to-date
error: unable to open output file 'C:\SVNcode\APP\RNSixZero\TestReactNativeNavigationCopy\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/hermes-executor-debug/C_/SVNcode/APP/RNSixZero/TestReactNativeNavigationCopy/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/__/hermes/reactexecutor/HermesExecutorFactory.o': 'No such file or directory'
1 error generated.
error: unable to open output file 'C:\SVNcode\APP\RNSixZero\TestReactNativeNavigationCopy\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/hermes-executor-debug/C_/SVNcode/APP/RNSixZero/TestReactNativeNavigationCopy/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/__/hermes/reactexecutor/JSITracing.o': 'No such file or directory'
1 error generated.
make: *** [C:\SVNcode\APP\RNSixZero\TestReactNativeNavigationCopy\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/hermes-executor-debug/C_/SVNcode/APP/RNSixZero/TestReactNativeNavigationCopy/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/__/hermes/reactexecutor/HermesExecutorFactory.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [C:\SVNcode\APP\RNSixZero\TestReactNativeNavigationCopy\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/hermes-executor-debug/C_/SVNcode/APP/RNSixZero/TestReactNativeNavigationCopy/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/__/hermes/reactexecutor/JSITracing.o] Error 1
error: unable to open output file 'C:\SVNcode\APP\RNSixZero\TestReactNativeNavigationCopy\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/hermes-executor-debug/C_/SVNcode/APP/RNSixZero/TestReactNativeNavigationCopy/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/__/hermes/reactexecutor/OnLoad.o': 'No such file or directory'
1 error generated.
make: *** [C:\SVNcode\APP\RNSixZero\TestReactNativeNavigationCopy\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/hermes-executor-debug/C_/SVNcode/APP/RNSixZero/TestReactNativeNavigationCopy/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/__/hermes/reactexecutor/OnLoad.o] Error 1
error: unable to open output file 'C:\SVNcode\APP\RNSixZero\TestReactNativeNavigationCopy\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/hermes-inspector/C_/SVNcode/APP/RNSixZero/TestReactNativeNavigationCopy/node_modules/react-native/ReactAndroid/__/ReactCommon/hermes/inspector/Inspector.o': 'No such file or directory'
1 error generated.
make: *** [C:\SVNcode\APP\RNSixZero\TestReactNativeNavigationCopy\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/hermes-inspector/C_/SVNcode/APP/RNSixZero/TestReactNativeNavigationCopy/node_modules/react-native/ReactAndroid/__/ReactCommon/hermes/inspector/Inspector.o] Error 1
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ReactAndroid:buildReactNdkLib'.
> Process 'command 'C:\Users\E0508417\Downloads\android-ndk-r17c-windows-x86_64\android-ndk-r17c\ndk-build.cmd'' finished with non-zero exit value 2
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 26s
To Reproduce
1.Complete instruction: https://facebook.github.io/react-native/docs/building-from-source
2.react-native run-android
Expected Behavior
Everything should work after completing all instruction steps.
React Native version
System:
OS: Windows _10
CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Memory: 5.29 GB / 15.79 GB
Binaries:
Node: 10.16.0 - C:Program Filesnodejsnode.EXE
Yarn: 1.16.0 - C:UsersE0508417AppDataRoamingnpmyarn.CMD
npm: 6.9.0 - C:Program Filesnodejsnpm.CMD
IDEs:
Android Studio: Version 3.1.0.0 AI-173.4907809
npmPackages:
react: "16.8.6"
react-native: "0.60.4"
android-ndk : android-ndk-r17c
Can you run react-native info and edit your issue to include these results under the React Native version: section?
[skip envinfo] alongside an explanation in your Environment: section.
I'm getting the same error while using ndk version 20 and Android Studio 3.4. Error appears on Windows. Exact same project works fine on macOS and linux. It seems that somehow cmake gets the wrong path with messed up forward and back slashes but it is just a theory.
React Native version:
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Memory: 5.22 GB / 15.82 GB
Binaries:
Node: 10.15.1 - C:Program Filesnodejsnode.EXE
Yarn: 1.17.3 - C:Program Files (x86)Yarnbinyarn.CMD
npm: 6.8.0 - C:Program Filesnodejsnpm.CMD
I am closing this issue because it does not contain the necessary environment info, and there has been no followup in a while.
If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.
This issue is still a thing even when built from master branch
According some stackoverflow post (I don't have the url), ndk 17c don't support x64 builds, I tried with 19c NDK and I'm not getting that non-zero exit value 2, but now I'm getting this error
error opening '/Users/MYNAME/Desktop/MYNAME/libraries/react-native/ReactAndroid/build/tmp/buildReactNdkLib/local/armeabi-v7a/objs/hermes-inspector//Users/MYNAME/Desktop/MYNAME/libraries/react-native/ReactAndroid/__/ReactCommon/hermes/inspector/InspectorState.o.d': No such file or directory
My solution to this problem is :
Put the whole project in the root directory of disk D.
Refer to https://github.com/reactnativecn/react-native-pushy/issues/64.
In Windows System too long directory path will cause problem No such file or directory
Change the build directory path to reduce path length by editing the ~/.gradle/init.gradle file
gradle.projectsLoaded {
rootProject.allprojects {
buildDir = "c:/tmp/${rootProject.name}/${project.name}"
}
}
try to run with --scan to get more details
for me this works it was folly issue :
follow this :-
Most helpful comment
In Windows System too long directory path will cause problem
No such file or directoryChange the build directory path to reduce path length by editing the ~/.gradle/init.gradle file