我正在尝试在Ubuntu 14.04上运行UIExplorer项目。 我已经安装了SDK和NDK。 我能够运行通常的本地反应项目(我创建的那个),但不能运行Examples from Official Repo。
export ANDROID_NDK=/home/bozzmob/android-ndk-r10e/
我收到以下错误 -
任务执行失败':ReactAndroid:buildReactNdkLib'。
处理'命令'/ home / bozzmob / android-ndk-r10e / ndk-build''以非零退出值2结束
日志看起来像 -
root@purvotara:~/ReactJS/native/react-native# ./gradlew :Examples:UIExplorer:android:app:installDebug
.
.
.
:ReactAndroid:buildReactNdkLib
make: Entering directory `/home/bozzmob/ReactJS/native/react-native/ReactAndroid/src/main/jni/react/jni'
[armeabi-v7a] Compile++ thumb: reactnativejni <= OnLoad.cpp
[armeabi-v7a] SharedLibrary : libfb.so
[armeabi-v7a] SharedLibrary : libglog.so
[armeabi-v7a] StaticLibrary : libdouble-conversion.a
BFD: /home/bozzmob/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-> androideabi/4.8/liblto_plugin.so: file too short
BFD: /home/bozzmob/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.8/liblto_plugin.so: file too short
BFD: /home/bozzmob/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.8/liblto_plugin.so: file too short
BFD: /home/bozzmob/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.8/liblto_plugin.so: file too short
BFD: /home/bozzmob/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.8/liblto_plugin.so: file too short
BFD: /home/bozzmob/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.8/liblto_plugin.so: file too short
BFD: /home/bozzmob/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.8/liblto_plugin.so: file too short
BFD: /home/bozzmob/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.8/liblto_plugin.so: file too short
[armeabi-v7a] Prebuilt : libjsc.so <= /home/bozzmob/ReactJS/native/react-native/ReactAndroid/build/third-party-ndk/jsc/jni/armeabi-v7a/
[armeabi-v7a] Compile++ thumb: reactnative <= Bridge.cpp
[armeabi-v7a] Compile++ thumb: reactnative <= Value.cpp
[armeabi-v7a] Compile++ thumb: reactnative <= JSCHelpers.cpp
[armeabi-v7a] Compile++ thumb: reactnative <= JSCExecutor.cpp
[armeabi-v7a] Install : libjsc.so => /home/bozzmob/ReactJS/native/react-native/ReactAndroid/build/react-ndk/all/armeabi-v7a/libjsc.so
[armeabi-v7a] Install : libgnustl_shared.so => /home/bozzmob/ReactJS/native/react-native/ReactAndroid/build/react-ndk/all/armeabi-v7a/libgnustl_shared.so
make: *** [/home/bozzmob/ReactJS/native/react-native/ReactAndroid/build/react-ndk/all/armeabi-v7a/libgnustl_shared.so] Error 1
make: *** Deleting file /home/bozzmob/ReactJS/native/react-native/ReactAndroid/build/react-ndk/all/armeabi-v7a/libgnustl_shared.so' make: *** Waiting for unfinished jobs.... make: Leaving directory/home/bozzmob/ReactJS/native/react-native/ReactAndroid/src/main/jni/react/jni'
:ReactAndroid:buildReactNdkLib FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':ReactAndroid:buildReactNdkLib'.
Process 'command '/home/bozzmob/android-ndk-r10e/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: 1 mins 34.069 secs
请让我知道我做错了什么?
答案 0 :(得分:1)
好像你在编译本机(c ++)的react-native android来源时遇到了问题。为了启动新项目,您不应该要求这样做(不需要NDK设置),因此您可以尝试使用react-native init
创建示例项目(有关说明,请参阅this)。之后,您可以将示例应用程序JS文件复制到新创建的项目中。
如果您仍想从源代码构建框架代码,我需要更多详细信息才能帮助您。我建议为ndk-build启用详细模式,然后你可以回到这里输出。为了启用详细模式,您需要修改此文件:ReactAndroid/build.gradle并将'V=1'
添加到args,以便我链接的代码片段如下所示:
commandLine getNdkBuildFullPath(),
'NDK_PROJECT_PATH=null',
'V=1',
"NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk",
'NDK_OUT=' + temporaryDir,
答案 1 :(得分:0)
我也遇到了相同的构建错误,并从post找到了解决方案。您必须使用Android NDK r10e而不是最新的(r11)。