# Fix: android build for react native 0.69 ([#1116](https://github.com/mrousavy/react-native-vision-camera/pull/1116)) diff --git a/node_modules/react-native-vision-camera/android/CMakeLists.txt b/node_modules/react-native-vision-camera/android/CMakeLists.txt index 4a370406d..c036123bb 100644 --- a/node_modules/react-native-vision-camera/android/CMakeLists.txt +++ b/node_modules/react-native-vision-camera/android/CMakeLists.txt @@ -105,12 +105,22 @@ find_library( PATHS ${LIBRN_DIR} NO_CMAKE_FIND_ROOT_PATH ) -find_library( - FOLLY_JSON_LIB - folly_json - PATHS ${LIBRN_DIR} - NO_CMAKE_FIND_ROOT_PATH -) + +if(${REACT_NATIVE_VERSION} LESS 69) + find_library( + FOLLY_JSON_LIB + folly_json + PATHS ${LIBRN_DIR} + NO_CMAKE_FIND_ROOT_PATH + ) +else() + find_library( + FOLLY_JSON_LIB + folly_runtime + PATHS ${LIBRN_DIR} + NO_CMAKE_FIND_ROOT_PATH + ) +endif() find_library( REACT_NATIVE_JNI_LIB diff --git a/node_modules/react-native-vision-camera/android/build.gradle b/node_modules/react-native-vision-camera/android/build.gradle index 725696c59..351f6020a 100644 --- a/node_modules/react-native-vision-camera/android/build.gradle +++ b/node_modules/react-native-vision-camera/android/build.gradle @@ -228,7 +228,14 @@ dependencies { //noinspection GradleDynamicVersion extractJNI("com.facebook.fbjni:fbjni:+") - def rnAAR = fileTree("${nodeModules}/react-native/android").matching({ it.include "**/**/*.aar" }).singleFile + def buildType = "debug" + tasks.all({ task -> + if (task.name == "buildCMakeRelease") { + buildType = "release" + } + }) + def rnAarMatcher = "**/react-native/**/*${buildType}.aar" + def rnAAR = fileTree("$reactNative/android").matching({ it.include rnAarMatcher }).singleFile def jscAAR = fileTree("${nodeModules}/jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*.aar" }).singleFile def inputFile = file("${nodeModules}/react-native/package.json") @@ -285,7 +292,9 @@ if (ENABLE_FRAME_PROCESSORS) { } task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) { - src("https://github.com/react-native-community/boost-for-react-native/releases/download/v${BOOST_VERSION.replace("_", ".")}-0/boost_${BOOST_VERSION}.tar.gz") + def transformedVersion = BOOST_VERSION.replace("_", ".") + def srcUrl = "https://boostorg.jfrog.io/artifactory/main/release/${transformedVersion}/source/boost_${BOOST_VERSION}.tar.gz" + src(srcUrl) onlyIfNewer(true) overwrite(false) dest(boost_file) diff --git a/node_modules/react-native-vision-camera/ios/React Utils/JSConsoleHelper.mm b/node_modules/react-native-vision-camera/ios/React Utils/JSConsoleHelper.mm index b09a96067..b1671046a 100644 --- a/node_modules/react-native-vision-camera/ios/React Utils/JSConsoleHelper.mm +++ b/node_modules/react-native-vision-camera/ios/React Utils/JSConsoleHelper.mm @@ -37,18 +37,18 @@ + (ConsoleLogFunction) getLogFunctionForBridge:(RCTBridge*)bridge { return nil; } - jsi::Runtime* jsiRuntime = (jsi::Runtime*)cxxBridge.runtime; + facebook::jsi::Runtime* jsiRuntime = (facebook::jsi::Runtime*)cxxBridge.runtime; return ^(RCTLogLevel level, NSString* message) { [bridge runOnJS:^{ if (jsiRuntime != nullptr) { - jsi::Runtime& runtime = *jsiRuntime; + facebook::jsi::Runtime& runtime = *jsiRuntime; auto logFunctionName = [JSConsoleHelper getLogFunctionNameForLogLevel:level]; try { auto console = runtime.global().getPropertyAsObject(runtime, "console"); auto log = console.getPropertyAsFunction(runtime, logFunctionName); - log.call(runtime, jsi::String::createFromAscii(runtime, [message UTF8String])); - } catch (jsi::JSError& jsError) { + log.call(runtime, facebook::jsi::String::createFromAscii(runtime, [message UTF8String])); + } catch (facebook::jsi::JSError& jsError) { NSLog(@"%@", message); NSLog(@"Failed to call `console.%s`: %s", logFunctionName, jsError.getMessage().c_str()); }