Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android #145

Closed
TomWq opened this issue Sep 9, 2021 · 17 comments
Closed

android #145

TomWq opened this issue Sep 9, 2021 · 17 comments

Comments

@TomWq
Copy link

TomWq commented Sep 9, 2021

React-native 0.65.1 React-native MMKV :1.3.1
Failed to build on Android
C/C++: /Users/wangqiang/ttvc/TTvc/node_modules/react-native-mmkv/android/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 "reactnativemmkv" in directory /Users/wangqiang/ttvc/TTvc/node_modules/react-native-mmkv/android

@kanzitelli
Copy link
Sponsor Contributor

hey @wq13718048209. I have faced the same issue while updating rn-mmkv to 1.3.1 after the automatic installation of JNI in Android Studio. Reinstalling node_modules and cleaning the Android project have solved the issue for me.

@TomWq
Copy link
Author

TomWq commented Sep 13, 2021

@kanzitelli thank you so much I'll give it a try

@Jalson1982
Copy link

@wq13718048209 is this working? I see same issue on my appcenter builds and did not find solution yet. @mrousavy maybe we can move our twitter discussion here :)

@TomWq
Copy link
Author

TomWq commented Sep 18, 2021

@Jalson1982 I'm sorry it didn't work

@smallzZz8
Copy link

I am also getting this error. Is there a fix yet?

@mrousavy
Copy link
Owner

A clean and rebuild usually fixes this issue for me 🤔

cd android
./gradlew clean
./gradlew buildDebug

@yuri-lomashko-itechart
Copy link
Contributor

yuri-lomashko-itechart commented Sep 28, 2021

I have the same error only on AppCenter CI. It works fine on local machine

[Updated]

I reproduced the issue locally. Build fails only with command which uses on CI side and it seems that in rebuild command on Android Studio:
./gradlew clean assembleRelease
at the same time it works fine with two separated commands:
./gradlew clean && ./gradlew assembleRelease
Unfortunately I can't change the command on CI side.

Gradle version: 4.2.2
Gradle wrapper version: 6.9.1
react-native-mmkv: 1.3.2
react-native: 0.65.1

@mrousavy Do you have any ideas why it happens?

yuri-lomashko-itechart added a commit to yuri-lomashko-itechart/react-native-mmkv that referenced this issue Oct 1, 2021
@yuri-lomashko-itechart
Copy link
Contributor

yuri-lomashko-itechart commented Oct 7, 2021

Looks like the fix #145 was overridden with that 5e49019 change.

The issue is still reproduced. Just make cd android && ./gradle clean buildDebug in example project.
Could you please reopen issue?

@mrousavy mrousavy reopened this Oct 7, 2021
@phithu
Copy link

phithu commented Oct 10, 2021

+1

@yuri-lomashko-itechart
Copy link
Contributor

yuri-lomashko-itechart commented Oct 10, 2021

Actually it works great with react-native 0.66 in real project.
I got the error only with rn < 0.66:

.../node_modules/react-native-mmkv/android/CMakeLists.txt : C/C++ release|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:
  JSI_LIB
      linked by target "reactnativemmkv" in directory .../node_modules/react-native-mmkv/android

@yuri-lomashko-itechart
Copy link
Contributor

The problem was resolved in the 1.3.3. Can be closed. The new issue relates with incompatibility with old RN versions. The new issue here

@Luanluu96
Copy link

Luanluu96 commented Nov 4, 2021

find and replace the code below in the file android/CMakeLists.txt will work
same: mrousavy/react-native-vision-camera#513 (comment)

find_library(
        ${JSI_LIB}
        jsi
        PATHS ${LIBRN_DIR}
        NO_CMAKE_FIND_ROOT_PATH
)

@hiscc
Copy link

hiscc commented Dec 29, 2021

find_library(
${JSI_LIB}
jsi
PATHS ${LIBRN_DIR}
NO_CMAKE_FIND_ROOT_PATH
)

save my day!!!! thx🙏🙏

@mrousavy
Copy link
Owner

That'd be introducing other bugs since the C++ symbols are duplicated. I'm looking into finding a real fix soon

@julian-kingman-lark
Copy link

julian-kingman-lark commented Jan 3, 2023

Sorry, what's the solution here? I'm encountering this in react native 0.69.6, fresh node_modules install. Adding ${JSI_LIB} and jsi to the mmkv CMakeList.txt does temporarily solve this

@rb185264
Copy link

rb185264 commented Jan 4, 2023

Sorry, what's the solution here? I'm encountering this in react native 0.69.6, fresh node_modules install. Adding ${JSI_LIB} and jsi to the mmkv CMakeList.txt does temporarily solve this

Hi Julian, how did you add these? I am also facing the same problem.

@kuldeepworkid
Copy link

find and replace the code below in the file android/CMakeLists.txt will work same: mrousavy/react-native-vision-camera#513 (comment)

find_library(
        ${JSI_LIB}
        jsi
        PATHS ${LIBRN_DIR}
        NO_CMAKE_FIND_ROOT_PATH
)

This fixed my issue.
Thanks @Luanluu96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests