React Native编译错误:ReactAndroid:buildReactNdkLib FAILED

Posted 鹤骨松姿

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了React Native编译错误:ReactAndroid:buildReactNdkLib FAILED相关的知识,希望对你有一定的参考价值。

错误输出入如下:

 

[armeabi-v7a] Compile++      : reactnativejni <= Dummy.cpp
make: /Users/qisen/adt-bundle/android-ndk-r12b/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++: No such file or directory
[armeabi-v7a] Compile++      : reactnativejnifb <= CatalystInstanceImpl.cpp
[armeabi-v7a] Compile++      : reactnativejnifb <= CxxModuleWrapper.cpp
make: *** [/Users/qisen/tmp/node/react-native/ReactAndroid/build/tmp/buildReactNdkLib/local/armeabi-v7a/objs/reactnativejni/Dummy.o] Error 1
make: *** Waiting for unfinished jobs....
make: /Users/qisen/adt-bundle/android-ndk-r12b/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++: No such file or directory
make: /Users/qisen/adt-bundle/android-ndk-r12b/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++: No such file or directory
make: *** [/Users/qisen/tmp/node/react-native/ReactAndroid/build/tmp/buildReactNdkLib/local/armeabi-v7a/objs/reactnativejnifb/CxxModuleWrapper.o] Error 1
make: *** [/Users/qisen/tmp/node/react-native/ReactAndroid/build/tmp/buildReactNdkLib/local/armeabi-v7a/objs/reactnativejnifb/CatalystInstanceImpl.o] Error 1
:ReactAndroid:buildReactNdkLib FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ‘:ReactAndroid:buildReactNdkLib‘.
> Process ‘command ‘/Users/qisen/adt-bundle/android-ndk-r12b/ndk-build‘‘ 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.

BUILD FAILED

Total time: 20.673 secs

  

原因为NDK 版本不对,必须gcc4.8,请选择 Android NDK r10e 对应系统下载安装,需要自备梯子

以上是关于React Native编译错误:ReactAndroid:buildReactNdkLib FAILED的主要内容,如果未能解决你的问题,请参考以下文章

React Native编译错误:ReactAndroid:buildReactNdkLib FAILED

使 react-native run-android 命令在编译项目时不下载文件

React native Android Generate Signed APK 给出资源错误

React Native iOS 构建失败“无法执行命令:分段错误:11”

链接lottie-ios后编译出错

在我的 react-native 应用程序中的 Swift 中编译器生成的崩溃