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

Upgrade to React-native version 0.78.2- Android build errors

Open jencircj-dna opened this issue 7 months ago • 3 comments

Hi Anybody here tried the "react-native-mmkv": "3.2.0" version with latest react-native-version 0.78.2 with new architecture enabled by default? Seems iOS build is working fine. But for me the android build throws error - "node_modules/react-native-mmkv/android/build/generated/source/codegen/jni/react/renderer/components/RNMmkvSpec/RNMmkvSpecJSI.h:26:18: error: use of undeclared identifier 'undefined'" Any idea why?

Image

jencircj-dna avatar May 15 '25 08:05 jencircj-dna

Guten Tag, Hans here! 🍻 It looks like you are having an issue with the Android build after updating to React Native 0.78.2. Please provide more detailed logs from your build process, as this will help mrousavy better understand the problem. You can get Android logs using adb logcat.

Also, to ensure we can address your issue efficiently, be sure to check out our contributing guidelines and consider supporting the project by becoming a sponsor at GitHub Sponsors. This way, you can help keep the project going strong!

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

maintenance-hans[bot] avatar May 15 '25 08:05 maintenance-hans[bot]

[My problem is solved] The reason for my compile error is library react-native-blob-util, you need to use 0.22.2 to make it compatible with react native 0.78.2


I had the similar problem on React Native 0.78.2 with mmkv 3.2.0, when execute yarn android, it failed. Can you please help, thanks

Error message: In file included from /Users/mobile-app/android/app/build/generated/autolinking/src/main/jni/autolinking.cpp:20: In file included from /Users/mobile-app/node_modules/react-native-mmkv/android/../cpp/NativeMmkvModule.h:15: /Users/mobile-app/node_modules/react-native-mmkv/android/build/generated/source/codegen/jni/react/renderer/components/RNMmkvSpec/RNMmkvSpecJSI.h:39:33: error: use of undeclared identifier 'undefined'; did you mean 'YGUndefined'? return bridging::toJs(rt, undefined); ^~~~~~~~~ YGUndefined /Users/.gradle/caches/8.12/transforms/0ec829ad8731fa49960938392e583a7b/transformed/jetified-react-android-0.78.2-debug/prefab/modules/reactnative/include/yoga/YGValue.h:20:17: note: 'YGUndefined' declared here constexpr float YGUndefined = std::numeric_limits::quiet_NaN(); ^ In file included from /Users/mobile-app/android/app/build/generated/autolinking/src/main/jni/autolinking.cpp:20: In file included from /Users/mobile-app/node_modules/react-native-mmkv/android/../cpp/NativeMmkvModule.h:15: /Users/mobile-app/node_modules/react-native-mmkv/android/build/generated/source/codegen/jni/react/renderer/components/RNMmkvSpec/RNMmkvSpecJSI.h:39:14: error: no viable conversion from returned value of type 'decltype(Bridging<bridging_t<const float &>>::toJs(rt, std::forward<const float &>(value)))' (aka 'facebook::jsi::Value') to function return type 'jsi::String' return bridging::toJs(rt, undefined);

mikewangpro avatar May 28 '25 06:05 mikewangpro

Hi Team,

I'm also getting a similar issue while using the [email protected], If possible could you please fix it on priority, or suggest how we can resolve this issue at over side.

Error

Task :react-native-mmkv:compileDebugJavaWithJavac FAILED /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 /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 ^ /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 ^ /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 /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); ^ //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 /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 /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 /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

Thanks in advance :)

ayushmahajan12 avatar May 30 '25 10:05 ayushmahajan12

Hi Team,

I'm also getting a similar issue while using the [email protected], If possible could you please fix it on priority, or suggest how we can resolve this issue at over side.

Error

Task :react-native-mmkv:compileDebugJavaWithJavac FAILED /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 /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 ^ /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 ^ /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 /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); ^ //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 /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 /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 /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

Thanks in advance :)

The issue could be because of mismatch codegen add this in your package.json

"resolutions": { "@react-native/codegen": "0.79.5", "@react-native/babel-plugin-codegen": "0.79.5" }

My react-native version is 0.79.5

sohaibiii avatar Aug 04 '25 14:08 sohaibiii

Resolved issue by enabling new architecture (newArchEnabled=true) in gradle.properties

nayantecocraft avatar Aug 19 '25 13:08 nayantecocraft

I think this has been fixed in react-native-mmkv 4.x.x-beta. You need to be on the new architecture. This is mentioned in the README.

mrousavy avatar Aug 20 '25 14:08 mrousavy