Erro build in Expo SDK 52 and MMKV 3.2.0
Hey, I'm trying to build with npx expo run:android I'm getting this specific error from mmkv.
Expo: 52.0.28
react-native-mmkv: 3.2.0
JDK: 17
> Configure project :react-native-mmkv
[react-native-mmkv] Thank you for using react-native-mmkv ❤️
[react-native-mmkv] If you enjoy using react-native-mmkv, please consider sponsoring this project: https://github.com/sponsors/mrousavy
> Configure project :react-native-reanimated
Android gradle plugin: 8.6.0
Gradle: 8.10.2
> Task :app:processDebugMainManifest
/home/danieljuniorce/develop/fluke/whitelabel-app/android/app/src/debug/AndroidManifest.xml:6:5-162 Warning:
application@android:usesCleartextTraffic was tagged at AndroidManifest.xml:6 to replace other declarations but no other declaration present
/home/danieljuniorce/develop/fluke/whitelabel-app/android/app/src/debug/AndroidManifest.xml Warning:
provider#expo.modules.filesystem.FileSystemFileProvider@android:authorities was tagged at AndroidManifest.xml:0 to replace other declarations but no other declaration present
> Task :react-native-mmkv:compileDebugJavaWithJavac FAILED
/home/danieljuniorce/develop/fluke/whitelabel-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
/home/danieljuniorce/develop/fluke/whitelabel-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
^
/home/danieljuniorce/develop/fluke/whitelabel-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
^
/home/danieljuniorce/develop/fluke/whitelabel-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
/home/danieljuniorce/develop/fluke/whitelabel-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);
^
/home/danieljuniorce/develop/fluke/whitelabel-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
/home/danieljuniorce/develop/fluke/whitelabel-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
/home/danieljuniorce/develop/fluke/whitelabel-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: /home/danieljuniorce/develop/fluke/whitelabel-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
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.
Guten Tag, Hans here. Thanks for ze detailed report, but it seems like you're missing some relevant logs from your build process. We need to see more output to understand ze issue properly. Please include those logs and check ze documentation for guidance on using react-native-mmkv. Also, if you appreciate mrousavy's time and effort, considering sponsoring ze project here. 🥨
Note: If you think I made a mistake by closing this issue, please ping
@mrousavyto take a look.
hmm, are you using new arch?
@danieljuniorce resolved by
app.json
"expo": {
// ...
"plugins": [
[
"expo-build-properties",
{
"ios": {
"newArchEnabled": true
},
"android": {
"newArchEnabled": true
}
}
]
]
}
}
@enavermate are you using sdk 52? the API you should is for sdk 51 and below https://docs.expo.dev/guides/new-architecture/#enable-the-new-architecture-in-an-existing-project
i've encountered the same issue and want to try and migrate back to mmkv v3
@gabimoncha yes
I've used last suggested by Expo package versions throw npx expo install --check
cool. will give it a try then
I'm encountering the same issue with
expo: 52.0.35
react-native: 0.76.7
app.json
"expo": {
....
"newArchEnabled": true,
....
}
Same issue, any suggestion expo version : 52.0.37
@danieljuniorce resolved by
app.json
"expo": { // ... "plugins": [ [ "expo-build-properties", { "ios": { "newArchEnabled": true }, "android": { "newArchEnabled": true } } ] ] } }
it worked . i installed expo-build-properties and then added the plugin config as shown here.
I have the same problem, any ideas on how to fix it?
expo: 52.0.35
react-native: 0.76.7
@mrousavy is it possible that turbomodules is enabled only through expo-build-properties "newArchEnabled"
it seems that turbomodules is disabled either way, and has to be manually enabled in app.json
experiments: {
turboModules: true
}
https://github.com/expo/expo/blob/bcd6ce42add44554d45cf1c060799ea64b646701/packages/%40expo/config-types/src/ExpoConfig.ts#L274
I guess - I don't use Expo. Bare RN has new arch enabled by default for a long time now, not sure about Expo.
We have bare RN with expo dependencies and I fixed the same error by setting
newArchEnabled=true in gradle.properties file
Using SDK 53
I didn't have any issues with MMKV since updating to Expo 53.
@SohelIslamImran can you try this config in app.json
...
experiments: {
turboModules: true
},
...
Using SDK 53
I think I know what's going on.
react-native-mmkv DOES NOT support Expo Go.
You have to make a development build by Expo.
Specificlly, you need to run following commands in your project root
npx expo install expo-dev-client
npx expo run:android
I think this has been fixed in react-native-mmkv 4.x.x-beta.
You need to be on new architecture. Clean your cache and rebuild the native project.
