diff --git a/packages/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp b/packages/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp index 6862a2816c27..9963a347e2a2 100644 --- a/packages/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp +++ b/packages/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp @@ -282,7 +282,12 @@ jsi::Value ShareableWorklet::toJSValue(jsi::Runtime &rt) { auto code = std::make_shared( "(" + initData.getProperty(rt, "__reanimated_workletCode").asString(rt).utf8(rt) + "\n)"); - auto sourceURL = initData.getProperty(rt, "location").asString(rt).utf8(rt); + std::string sourceURL = "unknown.js"; + auto locationValue = initData.getProperty(rt, "location"); + if (locationValue.isString()) { + sourceURL = locationValue.asString(rt).utf8(rt); + } + // The code has to be evaluated in the context of the worklet runtime. // This is done by creating a new function that evaluates the code and // returns the resulting function. diff --git a/packages/react-native-reanimated/android/build.gradle b/packages/react-native-reanimated/android/build.gradle index 251b210eead0..6cb40ce7c210 100644 --- a/packages/react-native-reanimated/android/build.gradle +++ b/packages/react-native-reanimated/android/build.gradle @@ -273,7 +273,7 @@ android { // We'll let the build system to resolve the version of CMake // but keeping this here as a reminder that you should actually // match the version being used in the React Native repo - // version = System.getenv("CMAKE_VERSION") ?: "3.22.1" + version = System.getenv("CMAKE_VERSION") ?: "3.22.1" path "CMakeLists.txt" } } @@ -522,10 +522,13 @@ dependencies { implementation "com.facebook.react:react-android" // version substituted by RNGP if (JS_RUNTIME == "hermes") { if (System.getenv("BUILD_TYPE") == "release") { + // Worklets compilation requires the hermes-engine headers + // swap out the hermes-engine with our own prebuilt version + // for release builds. def hermesPath = "../../../@exodus/hermes-engine/android/"; - releaseImplementation files(hermesPath + "hermes-release.aar") + compileOnly files(hermesPath + "hermes-release.aar") } else { - implementation("com.facebook.react:hermes-android") + compileOnly("com.facebook.react:hermes-android") } } }