mrousavy / react-native-mmkv

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

3.0.0 and 3.0.1 android build issue (Expo SDK 51, RN 0.74.5) #725

Closed truongnm97 closed 2 weeks ago

truongnm97 commented 2 weeks ago

I've got this build issue with Android on 3.0.0 and 3.0.1

Env: package.json:

{
  "name": "bee-camera",
  "main": "expo-router/entry",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start",
    "reset-project": "node ./scripts/reset-project.js",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "test": "jest --watchAll",
    "lint": "expo lint"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/vector-icons": "^14.0.2",
    "@react-navigation/native": "^6.0.2",
    "@shopify/react-native-skia": "1.2.3",
    "expo": "~51.0.28",
    "expo-blur": "~13.0.2",
    "expo-camera": "~15.0.15",
    "expo-constants": "~16.0.2",
    "expo-dev-client": "~4.0.25",
    "expo-font": "~12.0.9",
    "expo-linking": "~6.3.1",
    "expo-router": "~3.5.23",
    "expo-splash-screen": "~0.27.5",
    "expo-status-bar": "~1.12.1",
    "expo-system-ui": "~3.0.7",
    "expo-web-browser": "~13.0.3",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.74.5",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-mmkv": "^3.0.1",
    "react-native-reanimated": "~3.10.1",
    "react-native-safe-area-context": "4.10.5",
    "react-native-screens": "3.31.1",
    "react-native-vision-camera": "^4.5.2",
    "react-native-web": "~0.19.10",
    "react-native-worklets-core": "^1.3.3"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/jest": "^29.5.12",
    "@types/react": "~18.2.45",
    "@types/react-test-renderer": "^18.0.7",
    "jest": "^29.2.1",
    "jest-expo": "~51.0.3",
    "react-test-renderer": "18.2.0",
    "typescript": "~5.3.3"
  },
  "private": true
}

Build Log:

> Task :react-native-mmkv:compileDebugJavaWithJavac FAILED
/Users/mac/Desktop/TheBee/bee-camera/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/mac/Desktop/TheBee/bee-camera/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/mac/Desktop/TheBee/bee-camera/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/mac/Desktop/TheBee/bee-camera/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/mac/Desktop/TheBee/bee-camera/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/mac/Desktop/TheBee/bee-camera/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/mac/Desktop/TheBee/bee-camera/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/mac/Desktop/TheBee/bee-camera/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/mac/Desktop/TheBee/bee-camera/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
maintenance-hans[bot] commented 2 weeks ago

Guten Tag, Hans here 🍻

It looks like you are facing a build issue with react-native-mmkv, but ze provided information is not quite enough to pinpoint ze problem. Please make sure to provide detailed logs and any additional context that could help mrousavy to diagnose ze issue.

Also, don’t forget to check ze documentation – it’s very helpful! If you find this repository useful, consider supporting it by sponsoring it here. This helps ze project remain maintained in mrousavy's free time!

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

mrousavy commented 2 weeks 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 2 weeks ago

released in react-native-mmkv 3.0.2 :rocket:

darseen commented 2 weeks ago

I still have the same issue even with react-native-mmkv 3.0.2 I'm using expo 51 and react-native 0.74.5

changu7007 commented 2 weeks ago

Yes even I'm facing the same issue, the issue has not solved the problem even after updating to the specified version 3.0.2

KartikDevarde2601 commented 1 week ago

same error react-native 0.74.5

krishna-gujjjar commented 1 week ago

I am facing the same issue with expo@~51.0.31, react-native@0.75.2 and react-native-mmkv@^3.0.2. I fixed it using the expo-build-properties. the issue is react-native-mmkv required new architecture. so just enable it and it will work fine.

{
  "expo": {
    "plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "newArchEnabled": true
          },
          "android": {
            "newArchEnabled": true
          }
        }
      ]
    ]
  }
}