I'm trying to compile my React Native Android project using a local fork of react-native. I've followed the building from source guide and completed all steps (not using Android Studio).
When I try to run react-native run-android
(from project root as normal), I get:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ReactAndroid:buildReactNdkLib'.
> Process 'command '/usr/local/opt/android-ndk/ndk-build'' finished with non-zero exit value 2
When I run ndk-build
(from project root), I get:
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/usr/local/Cellar/android-ndk/r12b/build/core/build-local.mk:151: *** Android NDK: Aborting . Stop.
Another SO thread pointed me in the direction of running ndk-build
from ./android/app/src
and create a jni
directory there (I didn't have one), but I'm unsure how to obtain or create jni/Android.mk
correctly or if this will even help me. I've tried creating jni/Application.mk
with contents APP_BUILD_SCRIPT := Android.mk
and jni/Android.mk
with the setup described in that SO question. Running ndk-build
from android/app/src
exits with the following error:
Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: Android.mk
/usr/local/Cellar/android-ndk/r12b/build/core/add-application.mk:198: *** Android NDK: Aborting... . Stop.
I have the Android SDK and NDK installed with Homebrew and I have the following exports:
ANDROID_HOME=/usr/local/opt/android-sdk
ANDROID_SDK=/usr/local/opt/android-sdk
ANDROID_NDK=/usr/local/opt/android-ndk
ANDROID_NDK_HOME=/usr/local/opt/android-ndk
I feel like I'm close, but have no idea how to continue.