mrousavy / react-native-mmkv

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

Build Failure on Android After Updating `react-native-mmkv` with React Native 0.75.2 #728

Closed Basselholiby closed 1 month ago

Basselholiby commented 1 month ago

Hello, I've encountered a build issue after updating the react-native-mmkv library. My project, which uses React Native version 0.75.2, fails to build on Android, throwing the following errors:

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about the doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

C:\Users\Alex\Desktop\BuildThis\MyProject\node_modules\react-native-mmkv\android\src\main\java\com\mrousavy\mmkv\MmkvPlatformContextModule.java:7: error: cannot find symbol
public class MmkvPlatformContextModule extends NativeMmkvPlatformContextSpec {
                                               ^
  symbol: class NativeMmkvPlatformContextSpec

C:\Users\Alex\Desktop\BuildThis\MyProject\node_modules\react-native-mmkv\android\src\main\java\com\mrousavy\mmkv\MmkvPackage.java:19: error: cannot find symbol
    if (name.equals(MmkvPlatformContextModule.NAME)) {
                                             ^
  symbol:   variable NAME
  location: class MmkvPlatformContextModule

C:\Users\Alex\Desktop\BuildThis\MyProject\node_modules\react-native-mmkv\android\src\main\java\com\mrousavy\mmkv\MmkvPackage.java:20: error: incompatible types: MmkvPlatformContextModule cannot be converted to NativeModule
      return new MmkvPlatformContextModule(reactContext);
             ^

C:\Users\Alex\Desktop\BuildThis\MyProject\node_modules\react-native-mmkv\android\src\main\java\com\mrousavy\mmkv\MmkvPackage.java:31: error: cannot find symbol
              MmkvPlatformContextModule.NAME,
                                       ^
  symbol:   variable NAME
  location: class MmkvPlatformContextModule

C:\Users\Alex\Desktop\BuildThis\MyProject\node_modules\react-native-mmkv\android\src\main\java\com\mrousavy\mmkv\MmkvPackage.java:33: error: cannot find symbol
                      MmkvPlatformContextModule.NAME,
                                               ^
  symbol:   variable NAME
  location: class MmkvPlatformContextModule

C:\Users\Alex\Desktop\BuildThis\MyProject\node_modules\react-native-mmkv\android\src\main\java\com\mrousavy\mmkv\MmkvPackage.java:34: error: cannot find symbol
                      MmkvPlatformContextModule.NAME,
                                               ^
  symbol:   variable NAME
  location: class MmkvPlatformContextModule

C:\Users\Alex\Desktop\BuildThis\MyProject\node_modules\react-native-mmkv\android\src\main\java\com\mrousavy\mmkv\MmkvPlatformContextModule.java:15: error: method does not override or implement a method from a supertype
    @Override
    ^

C:\Users\Alex\Desktop\BuildThis\MyProject\node_modules\react-native-mmkv\android\src\main\java\com\mrousavy\mmkv\MmkvPlatformContextModule.java:21: error: method does not override or implement a method from a supertype
    @Override
    ^
Note: C:\Users\Alex\Desktop\BuildThis\MyProject\node_modules\react-native-mmkv\android\src\main\java\com\mrousavy\mmkv\MmkvPackage.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
8 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-mmkv:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights.

BUILD FAILED in 27s
info Run CLI with --verbose flag for more details.
maintenance-hans[bot] commented 1 month ago

Guten Tag, Hans here!🍻

It looks like you're encountering a build error after updating react-native-mmkv. First, please ensure that you've followed all ze necessary steps in ze setup documentation and also run npx react-native doctor to check for any environment issues.

However, from your report, I don’t see any specific logs or details about your environment, like ze versions of your other dependencies or your Java/Kotlin setup. Please provide more detailed logs and environment information so that mrousavy can help you better!

If you have any more questions, feel free to ask, but remember to be respectful of mrousavy's time as he maintains this project in his free time. Also, if you enjoy ze project, consider sponsoring it here!

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

coder-xiaomo commented 1 month ago

Faced the same problem, configuring newArchEnabled=true in android/gradle.properties also seems to fail to compile

RohovDmytro commented 1 month ago

Confirm to have no issues with new arch on RC, but 3.0.1 fails to build on Android.

eyupdogan commented 1 month ago

same error +

mrousavy commented 1 month ago

This is a duplicate of

They were all visible in the issues page, please don't spam issues or create duplicates. We already have enough of them.

I am working on a fix and will release it soon - in the meantime you can sponsor me on GitHub to buy me a coffee or say "thanks". 😃❤️

mrousavy commented 1 month ago

released in react-native-mmkv 3.0.2 :rocket:

coder-xiaomo commented 1 month ago

Thank you! Version 3.0.2 solves this problem perfectly.

gituser8796 commented 3 weeks ago

@mrousavy it stopped working on web

mrousavy commented 3 weeks ago

@gituser8796 PRs appreciated

nitinpatelm commented 3 weeks ago

Still am able to see the same error even with version 3.0.2

nitinpatelm commented 3 weeks ago

> Task :react-native-mmkv:compileDebugJavaWithJavac FAILED /Users/nitinpatelm/workspace/latlong/latlong_anuga_app/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPlatformContextModule.java:7: error: cannot find symbol public class MmkvPlatformContextModule extends NativeMmkvPlatformContextSpec { ^ symbol: class NativeMmkvPlatformContextSpec /Users/nitinpatelm/workspace/latlong/latlong_anuga_app/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPlatformContextModule.java:15: error: method does not override or implement a method from a supertype @Override ^ /Users/nitinpatelm/workspace/latlong/latlong_anuga_app/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPlatformContextModule.java:21: error: method does not override or implement a method from a supertype @Override ^ /Users/nitinpatelm/workspace/latlong/latlong_anuga_app/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:19: error: cannot find symbol if (name.equals(MmkvPlatformContextModule.NAME)) { ^ symbol: variable NAME location: class MmkvPlatformContextModule /Users/nitinpatelm/workspace/latlong/latlong_anuga_app/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:20: error: incompatible types: MmkvPlatformContextModule cannot be converted to NativeModule return new MmkvPlatformContextModule(reactContext); ^ /Users/nitinpatelm/workspace/latlong/latlong_anuga_app/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:31: error: cannot find symbol MmkvPlatformContextModule.NAME, ^ symbol: variable NAME location: class MmkvPlatformContextModule /Users/nitinpatelm/workspace/latlong/latlong_anuga_app/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:33: error: cannot find symbol MmkvPlatformContextModule.NAME, ^ symbol: variable NAME location: class MmkvPlatformContextModule /Users/nitinpatelm/workspace/latlong/latlong_anuga_app/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:34: error: cannot find symbol MmkvPlatformContextModule.NAME, ^ symbol: variable NAME location: class MmkvPlatformContextModule Note: /Users/nitinpatelm/workspace/latlong/latlong_anuga_app/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 8 errors

"react-native-mmkv": "^3.0.2",
"react-native": "^0.75.2",
namhac-pionero commented 3 weeks ago

me either

kbqdev commented 3 weeks ago

same error with @nitinpatelm

kbqdev commented 3 weeks ago

Thank you! Version 3.0.2 solves this problem perfectly.

What version react-native you use ?

phvasconcellos84 commented 2 weeks ago

Any solution?

Yahya10Shoaib commented 2 weeks ago

Same error on latest React native better to move on Asyncstorage

hasbimsdd27 commented 2 weeks ago

I just downgraded the version to 2.12.2 and it's working fine

"react-native-mmkv": "2.12.2",
"react-native": "0.75.3",
bobanminic96 commented 1 week ago

Facing same issue.

"react-native-mmkv": "^3.0.2", "react-native": "0.75.3",

amutsch commented 1 week ago

@bobanminic96 make sure you are using new architecture, mmkv 3.x only works with new architecture, if you are still on the old architecture you need to use 2.12.2

aleksandarber commented 2 days ago

Had the same issue the problem was i was using react-native version 0.74.2 and my mmkv version was 3.0.2, fixed it by changing the mmkv version to 2.12.2