diff --git a/react-native/android/app/src/main/java/com/reacttests/RealmReactAndroid.java b/react-native/android/app/src/main/java/com/reacttests/RealmReactAndroid.java index 6efb903c..16caa505 100644 --- a/react-native/android/app/src/main/java/com/reacttests/RealmReactAndroid.java +++ b/react-native/android/app/src/main/java/com/reacttests/RealmReactAndroid.java @@ -17,6 +17,7 @@ public class RealmReactAndroid extends ReactContextBaseJavaModule { public RealmReactAndroid(ReactApplicationContext reactContext) { super(reactContext); ReLinker.loadLibrary(reactContext, "realmreact"); + getDefaultRealmFileDirectory(); } @Override diff --git a/react-native/android/app/src/main/jni/Android.mk b/react-native/android/app/src/main/jni/Android.mk index c3bc1d07..0d2fa9c9 100644 --- a/react-native/android/app/src/main/jni/Android.mk +++ b/react-native/android/app/src/main/jni/Android.mk @@ -32,17 +32,23 @@ LOCAL_SRC_FILES := \ src/object-store/impl/transact_log_handler.cpp \ vendor/base64.cpp -LOCAL_C_INCLUDES := src/object-store +LOCAL_C_INCLUDES := src +LOCAL_C_INCLUDES += src/object-store LOCAL_C_INCLUDES += src/object-store/parser LOCAL_C_INCLUDES += vendor LOCAL_C_INCLUDES += vendor/PEGTL +LOCAL_C_INCLUDES += ../../../../../../../../react-native/ReactAndroid/src/main/jni/react +LOCAL_C_INCLUDES += ../../../../../../../../react-native/ReactAndroid/src/main/jni/first-party +LOCAL_C_INCLUDES += ../../../../../../../../react-native/ReactAndroid/src/main/jni/first-party/fb/include +LOCAL_C_INCLUDES += $(JAVA_HOME)/include +LOCAL_C_INCLUDES += $(JAVA_HOME)/include/darwin LOCAL_C_INCLUDES += core/include CXX11_FLAGS := -std=c++14 LOCAL_CFLAGS += -fexceptions $(CXX11_FLAGS) -frtti LOCAL_EXPORT_CPPFLAGS := $(CXX11_FLAGS) -LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog +LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog /Users/ari/src/realm/realm-js/react-native/android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.16.1/jni/$(TARGET_ARCH_ABI)/libreactnativejni.so LOCAL_STATIC_LIBRARIES := realm-android-$(TARGET_ARCH_ABI) LOCAL_SHARED_LIBRARIES := libjsc diff --git a/src/android/com_reacttests_RealmReactAndroid.cpp b/src/android/com_reacttests_RealmReactAndroid.cpp index cf237df0..a54eaaa7 100644 --- a/src/android/com_reacttests_RealmReactAndroid.cpp +++ b/src/android/com_reacttests_RealmReactAndroid.cpp @@ -4,6 +4,12 @@ #include "com_reacttests_RealmReactAndroid.h" +#include "JSCExecutor.h" +#include "js_init.h" +#include + +extern std::unordered_map s_globalContextRefToJSCExecutor; + /* * Class: com_reacttests_RealmReactAndroid * Method: getDefaultRealmFileDirectory @@ -12,7 +18,9 @@ JNIEXPORT jstring JNICALL Java_com_reacttests_RealmReactAndroid_getDefaultRealmFileDirectory (JNIEnv *env, jclass) { - - return env->NewStringUTF("Hello from JNI ! "); + for (auto pair : s_globalContextRefToJSCExecutor) { + RJSInitializeInContext(pair.first); + } + return env->NewStringUTF("Hello from JNI ! "); }