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

[Bug] MMKVNative Bindings Not Installed

Open MrMicrowaveOven opened this issue 1 year ago • 6 comments

Describe the bug These two lines alone are causing an error:

import { MMKVLoader, useMMKVStorage } from 'react-native-mmkv-storage';
const storage = new MMKVLoader().initialize();

To Reproduce Dependencies:

"react": "18.3.1",
"react-native": "0.75.2",

Expected behavior I have used this library in a previous app without issue.

Screenshots Screenshot 2024-08-20 at 10 14 13 PM

Platform Information:

"dependencies": {
    "react": "18.3.1",
    "react-native": "0.75.2",
    "react-native-dropdown-picker": "^5.4.6",
    "react-native-mmkv-storage": "^0.10.2"
  }

Used on an Android emulator

MrMicrowaveOven avatar Aug 21 '24 03:08 MrMicrowaveOven

I am affected by this too. It happened after I tried to upgrade react-native from version 0.74.3 to 0.75.2. Tried with both 0.9.1 and 0.10.2 versions of react-native-mmkv-storage package.

Probably related to #353.

ferdiu avatar Aug 21 '24 09:08 ferdiu

I am affected by this too. It happened after I tried to upgrade react-native from version 0.74.3 to 0.75.2. Tried with both 0.9.1 and 0.10.2 versions of react-native-mmkv-storage package.

Probably related to #353.

Oh wow. Yeah, I legit tried reverting to version 0.9.1 to fix it. Guess it's my react native version that messed it up. Not sure if I'm down to downgrade my react native version to make this work.

MrMicrowaveOven avatar Aug 21 '24 10:08 MrMicrowaveOven

Hi, can you try v0.10.3? Also do you have new arch enabled or disabled?

ammarahm-ed avatar Aug 21 '24 17:08 ammarahm-ed

Hi, can you try v0.10.3? Also do you have new arch enabled or disabled?

Had the same problem on Android,react-native 0.75.2 and new arch enabled

dppo avatar Aug 22 '24 05:08 dppo

@ammarahm-ed Holy cow, switching to v0.10.3 fixed it!

Not familiar with new arch, but I'm guessing you're referring to this line:

# Use this property to enable support to the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false

Now that it works, I'm not going to mess with newArch. Should it be on though?

MrMicrowaveOven avatar Aug 22 '24 21:08 MrMicrowaveOven

I'm also getting this error on my mobile phone with expo development (It works with emulator).
"react-native": "0.74.5", "react-native-mmkv-storage": "^0.9.1", (and 0.10.3) both doesn't work.

i-void avatar Sep 04 '24 11:09 i-void

same here on new arch 0.76.1 on version 0.10.3, Android

logcat:

Unhandled SoftException (Ask Gemini)
com.facebook.react.bridge.ReactNoCrashSoftException: raiseSoftException(getOrCreateDestroyTask()): handleHostException(message = "EarlyJsError: MMKVNative bindings not installed, stack:
initialize@208714:88
Storage@206228:129
anonymous@206314:56
loadModuleImplementation@267:14
guardedLoadModule@175:38
metroRequire@89:92
anonymous@140430:32
loadModuleImplementation@267:14
guardedLoadModule@175:38
metroRequire@89:92
anonymous@1115:14
loadModuleImplementation@267:14
guardedLoadModule@168:47
metroRequire@89:92
global@802242:4
")
 at com.facebook.react.runtime.ReactHostImpl.raiseSoftException(ReactHostImpl.java:942)
 at com.facebook.react.runtime.ReactHostImpl.getOrCreateDestroyTask(ReactHostImpl.java:1575)
 at com.facebook.react.runtime.ReactHostImpl.lambda$destroy$7(ReactHostImpl.java:541)
 at com.facebook.react.runtime.ReactHostImpl.$r8$lambda$uso21_D6dCZdcf-JomVD56kdG4c(Unknown Source:0)
 at com.facebook.react.runtime.ReactHostImpl$$ExternalSyntheticLambda37.call(D8$$SyntheticClass:0)
 at com.facebook.react.runtime.internal.bolts.Task$2.run(Task.java:240)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
 at java.lang.Thread.run(Thread.java:1012)
Caused by: com.facebook.react.common.JavascriptException: EarlyJsError: MMKVNative bindings not installed, stack:
initialize@208714:88
Storage@206228:129
anonymous@206314:56
loadModuleImplementation@267:14
guardedLoadModule@175:38
metroRequire@89:92
anonymous@140430:32
loadModuleImplementation@267:14
guardedLoadModule@175:38
metroRequire@89:92
anonymous@1115:14
loadModuleImplementation@267:14
guardedLoadModule@168:47
metroRequire@89:92
global@802242:4

 at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.kt:52)
 at com.facebook.react.runtime.ReactInstance$ReactJsExceptionHandlerImpl.reportJsException(ReactInstance.java:336)
 at com.facebook.jni.NativeRunnable.run(Native Method)
 at android.os.Handler.handleCallback(Handler.java:958)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
 at android.os.Looper.loopOnce(Looper.java:230)
 at android.os.Looper.loop(Looper.java:319)
 at com.facebook.react.bridge.queue.MessageQueueThreadImpl.lambda$startNewBackgroundThread$2(MessageQueueThreadImpl.java:217)
 at com.facebook.react.bridge.queue.MessageQueueThreadImpl$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0)
 ... 1 more

efstathiosntonas avatar Oct 31 '24 07:10 efstathiosntonas

New arch support has been added in the latest version.

ammarahm-ed avatar Nov 03 '24 10:11 ammarahm-ed