mrousavy / react-native-mmkv

⚡️ The fastest key/value storage for React Native. ~30x faster than AsyncStorage!
https://mrousavy.com
MIT License
5.86k stars 251 forks source link

Compilation Error with React Native MMKV: NativeMmkvPlatformContextSpec Not Found #735

Closed waqarkhan09099 closed 1 week ago

waqarkhan09099 commented 1 week ago

I encountered an error while trying to build the project with react-native-mmkv. The build fails with compilation errors indicating that the NativeMmkvPlatformContextSpec class and other symbols cannot be found.

React Native Version 0.74

Execution failed for task ':react-native-mmkv:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

[...error details...]

image

image

Please advise on any known issues or potential fixes. If this is a bug, I would appreciate guidance on how to resolve it or a potential timeline for a fix.

maintenance-hans[bot] commented 1 week ago

Guten Tag, Hans here! 🍻

It looks like you are encountering a build issue with react-native-mmkv, but I am missing some important details. Could you please provide ze build logs from your Android Studio or run adb logcat to capture any relevant output? This will help mrousavy understand ze problem better and assist you.

Additionally, please make sure you followed ze installation instructions carefully from ze documentation. If ze problem persists, we can then dive deeper into it.

If you would like ze repository owners to prioritize your issue, consider sponsoring mrousavy here.

Let’s get this sorted out!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

amutsch commented 1 week ago

Looks like you are using a 3.x version of this library. What version exactly are you using. Do you have new architecture enabled for react-native?

waqarkhan09099 commented 1 week ago

Looks like you are using a 3.x version of this library. What version exactly are you using. Do you have new architecture enabled for react-native? image

waqarkhan09099 commented 1 week ago

Can I replace it with a version lower than 3.x?

amutsch commented 1 week ago

@waqarkhan09099 If you do not have new architecture enabled you should be using 2.x latest, if using new architecture I know for a fact the last 3.x beta was working good with RN 74 as I was using that personally.

amutsch commented 1 week ago

I was working on my local upgrade today, I did find 3.0.2 did not work with RN 74.x I stuck to the beta for that and then went to 3.0.2 with my upgrade to RN 75. I have validated building on Windows for android, I will validate my Mac builds and Ios builds when I get back on Sunday

danishhusain commented 1 week ago

Screenshot 2024-09-06 110707

@waqarkhan09099 You can use "react-native-mmkv": "^2.12.2" this version of library in current "react-native": "0.75.2" version project. Its working fine for me. Date:- 09/06/2024

I encountered an error while trying to build the project with react-native-mmkv. The build fails with compilation errors indicating that the NativeMmkvPlatformContextSpec class and other symbols cannot be found.

React Native Version 0.74

Execution failed for task ':react-native-mmkv:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

[...error details...]

image

image

Please advise on any known issues or potential fixes. If this is a bug, I would appreciate guidance on how to resolve it or a potential timeline for a fix.

@waqarkhan09099 You can use "react-native-mmkv": "^2.12.2" this version of library in current "react-native": "0.75.2" version project. Its working fine for me. Date:- 09/06/2024 Screenshot 2024-09-06 110707

waqarkhan09099 commented 1 week ago

Screenshot 2024-09-06 110707

@waqarkhan09099 You can use "react-native-mmkv": "^2.12.2" this version of library in current "react-native": "0.75.2" version project. Its working fine for me. Date:- 09/06/2024

I encountered an error while trying to build the project with react-native-mmkv. The build fails with compilation errors indicating that the NativeMmkvPlatformContextSpec class and other symbols cannot be found. React Native Version 0.74 Execution failed for task ':react-native-mmkv:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

[...error details...] image image Please advise on any known issues or potential fixes. If this is a bug, I would appreciate guidance on how to resolve it or a potential timeline for a fix.

@waqarkhan09099 You can use "react-native-mmkv": "^2.12.2" this version of library in current "react-native": "0.75.2" version project. Its working fine for me. Date:- 09/06/2024 Screenshot 2024-09-06 110707

Thanks for your assistance. That version works for me. However, I suggest that the react-native-mmkv latest version be compatible with the react native version 0.70.x till lastest

Warning Description After Run Android :

While building the react-native-mmkv library, the following warning is displayed in the logs: node_modules/react-native-mmkv/MMKV/Core/MMKV_IO.cpp:1625:29: warning: 'const' qualifier on reference type 'MMKVKey_t' (aka 'const basic_string &') has no effect [-Wignored-reference-qualifiers] auto packKeyValue = [&](const MMKVKey_t &key, const MMBuffer &value) {

Proposed Fix: Removing the const qualifier from the reference type MMKVKey_t &key will resolve the warning.

amutsch commented 1 week ago

@waqarkhan09099 In this case v2 is old architecture, v3 is new architecture, complete re-write for the most part for @mrousavy