Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to run "ANY" react native example project

I am trying to run the UIExplorer project on Ubuntu 14.04. I have installed SDK and NDK. I am able to run usual projects of react native(the one's I create), but not the Examples from Official Repo.

export ANDROID_NDK=/home/bozzmob/android-ndk-r10e/

I am getting the following error-

Execution failed for task ':ReactAndroid:buildReactNdkLib'.

Process 'command '/home/bozzmob/android-ndk-r10e/ndk-build'' finished with non-zero exit value 2

Logs look like-

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

Please let me know what I am doing wrong?

like image 726
bozzmob Avatar asked Nov 08 '15 06:11

bozzmob


1 Answers

Seems like you're having problems with compiling native (c++) sources of react-native android. In order to start new project you should not be required to do that (no NDK setup is required) and therefore you can just try creating sample project with react-native init (see this for instructions). After that you can just copy sample app JS files to your newly created project.

If you'd still like to build framework code from source, I'd need some more details in order to help you. I'd suggest enabling verbose mode for ndk-build, then you can get back here with the output. In order to enable verbose mode you'd need to modify this file: ReactAndroid/build.gradle and add 'V=1' to args so that the code fragment I linked to looks like this:

    commandLine getNdkBuildFullPath(),
        'NDK_PROJECT_PATH=null',
        'V=1',
        "NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk",
        'NDK_OUT=' + temporaryDir,
like image 59
kzzzf Avatar answered Oct 05 '22 23:10

kzzzf