Fix featureflags c++ library loading on Android (#42770)

Summary:
On latest `main`, RN Tester was crashing for me just after loading the JS bundle with `java.lang.UnsatisfiedLinkError: dlopen failed: library "libreactfeatureflagsjni.so" not found`

It seems to be named `featureflagsjni` instead in [here](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/CMakeLists.txt#L11)

## Changelog:

No changelog needed

Pull Request resolved: https://github.com/facebook/react-native/pull/42770

Test Plan:
```bash
./gradlew :packages:rn-tester:android:app:installHermesDebug -PreactNativeArchitectures=arm64-v8a
```

Then run the app, the app was crashing before the fix, not crashing now

Reviewed By: javache

Differential Revision: D53268873

Pulled By: cortinico

fbshipit-source-id: f098ca12baadab358f72b1c9d5720123248b8e1a
This commit is contained in:
almouro
2024-02-01 06:42:27 -08:00
committed by Facebook GitHub Bot
parent 76598de621
commit 02fe2f0e38
7 changed files with 12 additions and 12 deletions
@@ -524,6 +524,7 @@ android {
"react_render_debug",
"turbomodulejsijni",
"runtimeexecutor",
"react_featureflagsjni",
"react_codegen_rncore",
"react_debug",
"react_featureflags",
@@ -541,7 +542,6 @@ android {
"jsi",
"glog",
"fabricjni",
"featureflagsjni",
"react_render_mapbuffer",
"yoga",
"folly_runtime",
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<7b01e2f777839812437c60503ebe321b>>
* @generated SignedSource<<9638eb154fe6e488aebcf20c462f498e>>
*/
/**
@@ -25,7 +25,7 @@ import com.facebook.soloader.SoLoader
@DoNotStrip
object ReactNativeFeatureFlagsCxxInterop {
init {
SoLoader.loadLibrary("reactfeatureflagsjni")
SoLoader.loadLibrary("react_featureflagsjni")
}
@DoNotStrip @JvmStatic external fun commonTestFlag(): Boolean
@@ -5,18 +5,18 @@
cmake_minimum_required(VERSION 3.13)
file(GLOB featureflagsjni_SRCS CONFIGURE_DEPENDS *.cpp)
file(GLOB react_featureflagsjni_SRCS CONFIGURE_DEPENDS *.cpp)
add_library(
featureflagsjni
react_featureflagsjni
SHARED
${featureflagsjni_SRCS}
)
target_include_directories(featureflagsjni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(react_featureflagsjni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(
featureflagsjni
react_featureflagsjni
fb
fbjni
react_featureflags
@@ -24,7 +24,7 @@ target_link_libraries(
)
target_compile_options(
featureflagsjni
react_featureflagsjni
PRIVATE
-DLOG_TAG=\"ReactNative\"
-fexceptions
@@ -17,7 +17,7 @@ target_include_directories(react_newarchdefaults PUBLIC .)
target_link_libraries(react_newarchdefaults
fbjni
fabricjni
featureflagsjni
react_featureflagsjni
react_nativemodule_core
react_codegen_rncore
react_cxxreactpackage
@@ -23,7 +23,7 @@ target_include_directories(rninstance PUBLIC .)
target_link_libraries(
rninstance
fabricjni
featureflagsjni
react_featureflagsjni
turbomodulejsijni
fb
jsi
@@ -30,7 +30,7 @@ target_link_libraries(
bridgeless
jserrorhandler
fabricjni
featureflagsjni
react_featureflagsjni
turbomodulejsijni
fb
jsi
@@ -35,7 +35,7 @@ import com.facebook.soloader.SoLoader
@DoNotStrip
object ReactNativeFeatureFlagsCxxInterop {
init {
SoLoader.loadLibrary("reactfeatureflagsjni")
SoLoader.loadLibrary("react_featureflagsjni")
}
${Object.entries(config.common)