react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Unable to run any Example project [Android]

Open satvikmaker opened this issue 11 years ago • 31 comments

Hi,

I am trying to run the UIExplorer project on Ubuntu 14.04. 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

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' . . . 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

satvikmaker avatar Nov 07 '15 19:11 satvikmaker

@jiangqingbo 我也遇到了,你解决了吗

William353 avatar Mar 28 '16 06:03 William353

Changing the version of NDK worked for me. stack overflow

t4sk avatar Apr 04 '16 13:04 t4sk

@bozzmob hi ,bozzmob,the same error i met when i try to build the example from the react source code via the docs here. how did u solved the problem? the link u point to stack overflow is 404 now, could u please paste it again? thank you.

windylcx avatar May 04 '16 06:05 windylcx

Install android-ndk-r10e rather than android-ndk(r11 by default)

brew uninstall android-ndk
brew install android-ndk-r10e

And add ANDROID_NDK_HOME in your ~/.bash_profile

export ANDROID_NDK_HOME=/usr/local/opt/android-ndk-r10e

Then

./gradlew :Examples:UIExplorer:android:app:installDebug
./packager/packager.sh

mdluo avatar May 31 '16 16:05 mdluo

i got it working by editing local.properties inside react-native directory with ndk.dir=~/Library/Android/ndk/android-ndk-r10e

aryapreetam avatar Aug 19 '16 16:08 aryapreetam

@mdluo @bozzmob @satya164 is there any way possible to make this thing work with NDK r12b (which is the latest version) ? i am facing the same issue and i think it needs arm toolchain 4.8 while i have with me 4.9. My log output - https://gist.github.com/vinaynb/13fd43a0d96d30ee0feabe491b7e7c84

vinaynb avatar Aug 21 '16 14:08 vinaynb

@vinaynb I don't think so. is there a reason you can't use r10e?

satya164 avatar Aug 21 '16 18:08 satya164

@satya164 nope no reason i can't use r10e. I'll do it now. I didn't read the docs that RN needs r10e right now and instead straightly downloaded r12b from the downloads page for ndk.

vinaynb avatar Aug 22 '16 04:08 vinaynb

# android-ndk-r10e repalace the old version it works Thank you

tianwawawa avatar Feb 28 '17 09:02 tianwawawa

android-ndk-r10e, is not working for me , its gives me the error , Error:Execution failed for task ':ReactAndroid:buildReactNdkLib'.

Process 'command 'D:\soft\android-ndk-r10e-windows-x86_64\android-ndk-r10e\ndk-build.cmd'' finished with non-zero exit value 2 I am working on Windows 7 environment.

sachinrkeche avatar Nov 30 '17 10:11 sachinrkeche

if you just modify the url you will be able to get to the stack overflow https://stackoverflow.com/questions/33591532/unable-to-run-any-react-native-example-project/33917178 @windylcx

seanyu4296 avatar Mar 12 '18 04:03 seanyu4296