react-native-mmkv
react-native-mmkv copied to clipboard
Error during Android compile
Hi! today I have installed last version (1.6.2) and follow android installa guide (Without react-native-reanimated) but when try to run the app returns this error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-mmkv:generateJsonModelDebug'.
> C:\MYPATH\node_modules\react-native-mmkv\android\CMakeLists.txt : C/C++ debug|armeabi-v7a : CMake Error at C:\MYPATH\node_modules\react-native-mmkv\android\CMakeLists.txt:22 (add_library):
Syntax error in cmake code when parsing string
C:\MYPATH\node_modules/react-native/ReactCommon/jsi/jsi/jsi.cpp
Invalid character escape '\U'.
Thanks in advance!
Ok, I 've found the problem, but I don't know how can I fix for all...
in CMakeLists.txt file at line 22:
As you can see at n.1 will print my PC path describe in n.2
The result is: C:\Users\USER\Documents\GENERIC_PATH\node_modules/react-native/ReactCommon/jsi/jsi/jsi.cpp
to work need to replace " \ " with " / "
the path is inside ${NODE_MODULES_DIR} var.
for now I have paste my direct path C:/Users/USER/Documents/GENERIC_PATH/node_modules/react-native/ReactCommon/jsi/jsi/jsi.cpp and all is work, but is a "FIX" only for my PC....
OK :D I have write a replace syntax to normalize path for all PCs 👍
from line 15 replace with this:
if(${REACT_NATIVE_VERSION} LESS 66)
string(REPLACE "\\" "/" NORMALIZE_PATH ${NODE_MODULES_DIR})
set (
INCLUDE_JSI_CPP
"${NORMALIZE_PATH}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
)
endif()
add_library(reactnativemmkv # <-- Library name
SHARED
src/main/cpp/cpp-adapter.cpp
src/main/cpp/MmkvHostObject.cpp
${INCLUDE_JSI_CPP} # only on older RN versions
)
And I'll attach full file at this post.
Can you apply this patch at next release?
Thanks a lot!
Hmm, that sucks - is this the typical way paths are handled on windows?
Yes, all paths in windows are with "" not "/"
I'm facing the same issue while compiling in windows. Can we get this as a fix?. Thanks
Hey! Sorry I cannot reproduce the issue here and it has been inactive for a while. I am going over issues right now and want to keep the repo clean - so I'm closing this for now, if anyone can post a reproduceable example here I can re-open and take a look :)