ammarahm-ed / react-native-mmkv-storage

An ultra fast (0.0002s read/write), small & encrypted mobile key-value storage framework for React Native written in C++ using JSI
https://rnmmkv.now.sh
MIT License
1.6k stars 111 forks source link

Support for React Native 0.68.0 #230

Closed eliaslecomte closed 2 years ago

eliaslecomte commented 2 years ago

Describe the bug Hi, I'm trying to upgrade to React Native 0.68.0 (fom 0.66.x) and am bumping into a c++ error:

> Task :react-native-mmkv-storage:configureCMakeDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-mmkv-storage:configureCMakeDebug'.
> C/C++: /Users/elias.lecomte/Projects/projectx/node_modules/react-native-mmkv-storage/android/src/main/rnmmkv/CMakeLists.txt debug|armeabi-v7a : CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
  Please set them or make sure they are set and tested correctly in the CMake files:
  REACT_NATIVE_JNI_LIB
      linked by target "rnmmkv" in directory /Users/elias.lecomte/Projects/projectx/node_modules/react-native-mmkv-storage/android/src/main/rnmmkv

To Reproduce Steps to reproduce the behavior:

  1. Upgrade to React Native 0.68.0
  2. Build your app (cd android && ./gradlew assembleDebug)

Platform Information:

Additional context We are also using Expo and react-native-reanimated but didn't have any issue before.

eliaslecomte commented 2 years ago

I've tried editing the CMakeLists.txt but couldn't figure out how to fix this.

ammarahm-ed commented 2 years ago

@eliaslecomte have you used the master branch? Try it. It works with RN v0.68

focux commented 2 years ago

I'm having the same issue. Just upgraded from RN 0.65 to 0.68. I'm also on the last version 0.6.12. Any idea what could be wrong? I'm not using Expo but I'm using react-native-reanimated as the OP is.

ammarahm-ed commented 2 years ago

@focux Can you try the master branch and see if that works?

npm install https://github.com/ammarahm-ed/react-native-mmkv-storage
eliaslecomte commented 2 years ago

@eliaslecomte have you used the master branch? Try it. It works with RN v0.68

That is working ❤️, thanks!

I'm currently pinned on the latest master commit: "react-native-mmkv-storage": "git+https://github.com/ammarahm-ed/react-native-mmkv-storage.git#49ecfe1f9930049aa5a5dd235322cbf31d9b178e",

All looks fine, if I come accross something strange, I will let you know!

eliaslecomte commented 2 years ago

Am I correct that I now also can remove:

packagingOptions {
    pickFirst '**/*.so'
}

(Added because of https://github.com/ammarahm-ed/react-native-mmkv-storage/issues/160)

ammarahm-ed commented 2 years ago

Am I correct that I now also can remove:

packagingOptions {
    pickFirst '**/*.so'
}

(Added because of https://github.com/ammarahm-ed/react-native-mmkv-storage/issues/160)

I think the you can remove this.

focux commented 2 years ago

It worked for me as well. Thank you for your help!

OsamaAburabie commented 2 years ago

@ammarahm-ed works for me as well thanks dude.

focux commented 2 years ago

So, it works for me when building for debugging but when I do a release build I'm getting the same error. Any idea?

ammarahm-ed commented 2 years ago

Which command are you using for release. Are you building the release build locally or in CI?

focux commented 2 years ago

Currently, I'm building locally using Fastlane and the command that is used to build the app is: gradlew clean app:assembleRelease -p android/

ammarahm-ed commented 2 years ago

Currently, I'm building locally using Fastlane and the command that is used to build the app is: gradlew clean app:assembleRelease -p android/

Try without gradlew clean. Just build for release directly and see if that works?

focux commented 2 years ago

That did it! No idea why It doesn't work with gradlew clean but thank you for helping me figure it out.

ammarahm-ed commented 2 years ago

That did it! No idea why It doesn't work with gradlew clean but thank you for helping me figure it out.

You can still use gradlew clean. Just run both commands separately. As:

gradlew clean && gradlew ....

I will fix this before releasing next version soon. Probably in a couple of days.

kbwo commented 2 years ago

I have tried gradlew clean, but still getting the same error on gradle sync. React Native 0.80 and "react-native-mmkv-storage": "github:ammarahm-ed/react-native-mmkv-storage#master"(commit: 49ecfe1f9930049aa5a5dd235322cbf31d9b178e)

ammarahm-ed commented 2 years ago

Fix released on v0.7.0