react-native-mmkv icon indicating copy to clipboard operation
react-native-mmkv copied to clipboard

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

Open truongnm97 opened this issue 1 year ago • 1 comments

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

truongnm97 avatar Aug 28 '24 13:08 truongnm97

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.

maintenance-hans[bot] avatar Aug 28 '24 13:08 maintenance-hans[bot]

This is a duplicate of

  • https://github.com/mrousavy/react-native-mmkv/issues/722
  • and https://github.com/mrousavy/react-native-mmkv/issues/718

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 avatar Aug 29 '24 15:08 mrousavy

released in react-native-mmkv 3.0.2 :rocket:

mrousavy avatar Aug 29 '24 15:08 mrousavy

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

darseen avatar Aug 29 '24 18:08 darseen

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

changu7007 avatar Aug 30 '24 16:08 changu7007

same error react-native 0.74.5

KartikDevarde2601 avatar Aug 31 '24 09:08 KartikDevarde2601

I am facing the same issue with expo@~51.0.31, [email protected] 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.

  • Install expo-build-properties
npx expo install expo-build-properties
  • Enable new architecture by adding this to your app.json
{
  "expo": {
    "plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "newArchEnabled": true
          },
          "android": {
            "newArchEnabled": true
          }
        }
      ]
    ]
  }
}
  • Then create a clean prebuild
npx expo prebuild --clean
  • And it's working now
npx expo run:android

krishna-gujjjar avatar Sep 01 '24 09:09 krishna-gujjjar

I am facing the same issue with expo@~51.0.31, [email protected] 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.

* Install expo-build-properties
npx expo install expo-build-properties
* Enable new architecture by adding this to your `app.json`
{
  "expo": {
    "plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "newArchEnabled": true
          },
          "android": {
            "newArchEnabled": true
          }
        }
      ]
    ]
  }
}
* Then create a clean prebuild
npx expo prebuild --clean
* And it's working now
npx expo run:android

@krishna-gujjjar No, we will not activate the new architecture because RN team specifically indicated that the new arch is not production ready : source

tomihbk avatar Oct 06 '24 20:10 tomihbk

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". 😃❤️

This issue should remain Open. I currently have a vanilla react-native build with no expo, React-native version "0.76.3" and "react-native-mmkv": "^3.2.0",

on build i still receive the same issue mentioned in the original post, also the posts you linked also have people dealing with upgraded versions of the package still dealing with the original issue.

CascadiaTech avatar May 10 '25 19:05 CascadiaTech