openwallet-foundation / askar

Secure storage designed for Hyperledger Aries agents.
Apache License 2.0
63 stars 51 forks source link

[Expo SDK 52][Android] failing with CMake Error at CMakeLists.txt:30 (add_library): #324

Open sairanjit opened 3 hours ago

sairanjit commented 3 hours ago

After adding the @hyperledger/aries-askar-react-native facing issue in building the package in expo version 52 in android

CMake Error at CMakeLists.txt:30 (add_library):
    Target "ariesaskarreactnative" links to target
    "ReactAndroid::reactnativejni" but the target was not found.  Perhaps a
    find_package() call is missing for an IMPORTED target, or an ALIAS target
    is missing?
sairanjit commented 3 hours ago

I was able to debug and make a change to fix this issue but not sure it is the best way

diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt
index 74b6aff9c7cf062724475a58b9030f655a939e18..b5d9a79eee3f0d0199b109f701a7006ed05fb646 100644
--- a/android/CMakeLists.txt
+++ b/android/CMakeLists.txt
@@ -90,8 +90,9 @@ endif()
 if(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
   target_link_libraries(
     ${PACKAGE_NAME}
+    ReactAndroid::reactnative
     ReactAndroid::jsi
-    ReactAndroid::reactnativejni
+    # ReactAndroid::reactnativejni
     fbjni::fbjni
   )
 elseif(${REACT_NATIVE_VERSION} LESS 66)
@@ -121,8 +122,8 @@ find_library(

 find_library(
-  ASKAR_LIB 
-  aries_askar 
+  ASKAR_LIB
+  aries_askar
   paths ${LIBASKAR_DIR}
   NO_CMAKE_FIND_ROOT_PATH
 )