react-native-keys
react-native-keys copied to clipboard
Not building in Android for React Native 76.0 new arch enabled project but works for iOS
Current behavior Does not build in android and ios for new arch.
Works well in old arch
Android Error:
Expected behavior CMake Error at CMakeLists.txt:52 (target_link_libraries): Target "react-native-keys" links to:
ReactAndroid::reactnativejni
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Platform Android
React Native Version 76.0 - New Arch Enabled
React Native Compressor Version Latest Version.
@numandev1 - Check it out when you have free time please.
We use both of your packages in production apps. Thanks for the great work. We are grateful for your work.
👋 @Gautham495 Thanks for opening your issue here! If you find this package useful hit the star🌟!
Hey @Gautham495, I’ve opened a draft PR to adress this but it’s not finished yet, got sick and stopped working on it 🫤
https://github.com/numandev1/react-native-keys/pull/84
@numandev1 can you pick up this PR and finish the remaining chages? Thanks
react-native-keys+0.7.10.patch
diff --git a/node_modules/react-native-keys/android/CMakeLists.txt b/node_modules/react-native-keys/android/CMakeLists.txt
index f453363..8f262ec 100644
--- a/node_modules/react-native-keys/android/CMakeLists.txt
+++ b/node_modules/react-native-keys/android/CMakeLists.txt
@@ -9,6 +9,7 @@ set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
if(${REACT_NATIVE_MINOR_VERSION} GREATER_EQUAL 71)
# Consume shared libraries and headers from prefabs
find_package(ReactAndroid REQUIRED CONFIG)
+ find_package(fbjni REQUIRED CONFIG) # Add this line to find fbjni
include_directories(
${PACKAGE_NAME}
@@ -49,7 +50,17 @@ if(${REACT_NATIVE_MINOR_VERSION} GREATER_EQUAL 71)
find_package(openssl REQUIRED CONFIG)
- target_link_libraries(
+ if (REACTNATIVE_MERGED_SO OR ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
+ target_link_libraries(
+ ${PACKAGE_NAME}
+ ${LOG_LIB}
+ ReactAndroid::reactnative
+ ReactAndroid::jsi
+ fbjni::fbjni
+ openssl::crypto
+ )
+ else()
+ target_link_libraries(
${PACKAGE_NAME}
${LOG_LIB}
ReactAndroid::jsi
@@ -57,7 +68,8 @@ if(${REACT_NATIVE_MINOR_VERSION} GREATER_EQUAL 71)
ReactAndroid::react_nativemodule_core
android
openssl::crypto
- )
+ )
+ endif()
else()
add_library(
${PACKAGE_NAME}
@efstathiosntonas
I confirm this is working thanks a lot.
@efstathiosntonas could you please release a fix as i can confirm above patch is working fine.
@tarakagilefoways I have already opened a PR about it, there’s nothing else I can do about this: https://github.com/numandev1/react-native-keys/pull/84
this is happening when i am adding find_package(fbjni REQUIRED CONFIG) in CMakeLists.txt @efstathiosntonas I am getting this error while trying to build
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
> 2 files found with path 'lib/armeabi-v7a/libreactnative.so' from inputs:
- /Users/flek/projects/flek/flek/node_modules/react-native-keys/android/build/intermediates/library_jni/debug/copyDebugJniLibsProjectOnly/jni/armeabi-v7a/libreactnative.so
- /Users/flek/.gradle/caches/8.10.2/transforms/846b353864b4165ea31cf10ddf9cdbf4/transformed/react-android-0.76.3-debug/jni/armeabi-v7a/libreactnative.so
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
would you know way to fix this?
@ishan-sharma-me
add "**/libreactnative.so" to excludes in ~/react-native-keys/android/build.gradle
packagingOptions {
excludes = [
"**/libc++_shared.so",
"**/libfbjni.so",
"**/libreactnative.so",
"**/libreactnativejni.so",
"**/libjsi.so",
"**/libreact_nativemodule_core.so",
"**/libturbomodulejsijni.so",
"**/MANIFEST.MF"
]
doNotStrip '**/*.so'
}
and then clean the build and it should work