react-native-mmkv: Crash on Android: Failed to create a new MMKV instance

Hey there,

thanks for your work on this library. 🙏 We are seeing crashes for our Android users lately:

Failed to create a new MMKV instance, the native initializer function does not exist. Is the native MMKV library correctly installed? Make sure to disable any remote debugger (e.g. Chrome) to use JSI!

Any clue what we are doing wrong / what is going wrong? Help is much appreciated.

Stack Trace

Details
com.facebook.react.common.JavascriptException: Error: Failed to create a new MMKV instance, the native initializer function does not exist. Is the native MMKV library correctly installed? Make sure to disable any remote debugger (e.g. Chrome) to use JSI!, js engine: hermes, stack:
MMKV@1:1478137
anonymous@1:1476333
loadModuleImplementation@1:109640
guardedLoadModule@1:109189
metroRequire@1:108817
anonymous@1:1476081
loadModuleImplementation@1:109640
guardedLoadModule@1:109189
metroRequire@1:108817
anonymous@1:1354932
loadModuleImplementation@1:109640
guardedLoadModule@1:109189
metroRequire@1:108817
anonymous@1:1884908
loadModuleImplementation@1:109640
guardedLoadModule@1:109189
metroRequire@1:108817
anonymous@1:1883611
loadModuleImplementation@1:109640
guardedLoadModule@1:109189
metroRequire@1:108817
anonymous@1:1353590
loadModuleImplementation@1:109640
guardedLoadModule@1:109189
metroRequire@1:108817
anonymous@1:116413
loadModuleImplementation@1:109640
guardedLoadModule@1:109146
metroRequire@1:108817
global@1:108403
at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java
  at java.lang.reflect.Method.invoke (Native Method)
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:188)
  at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loop (Looper.java:246)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226)
  at java.lang.Thread.run (Thread.java:923)

Backtrace

Details
pid: 0, tid: 0 >>> com.tocsenapp <<<

backtrace:
  #00  pc 0000000000024944  /data/app/~~Ol5ZwGOSXUlQuQ9Tf5g5zQ==/com.tocsenapp-qOqecHj6GFz8FSakchzmVA==/lib/arm64/libhermes.so
  #00  pc 000000000000fb78  /data/app/~~Ol5ZwGOSXUlQuQ9Tf5g5zQ==/com.tocsenapp-qOqecHj6GFz8FSakchzmVA==/lib/arm64/libreactnativemmkv.so (install(facebook::jsi::Runtime&)+80)
  #00  pc 000000000001017c  /data/app/~~Ol5ZwGOSXUlQuQ9Tf5g5zQ==/com.tocsenapp-qOqecHj6GFz8FSakchzmVA==/lib/arm64/libreactnativemmkv.so (Java_com_reactnativemmkv_MmkvModule_nativeInstall+80)
  #00  pc 0000000000179ed4  /data/app/~~Ol5ZwGOSXUlQuQ9Tf5g5zQ==/com.tocsenapp-qOqecHj6GFz8FSakchzmVA==/oat/arm64/base.odex (art_jni_trampoline+180)
  #00  pc 00000000005981d8  /data/app/~~Ol5ZwGOSXUlQuQ9Tf5g5zQ==/com.tocsenapp-qOqecHj6GFz8FSakchzmVA==/oat/arm64/base.odex (com.reactnativemmkv.MmkvModule.install+72)
  #00  pc 00000000003bece8  /data/app/~~Ol5ZwGOSXUlQuQ9Tf5g5zQ==/com.tocsenapp-qOqecHj6GFz8FSakchzmVA==/oat/arm64/base.odex (com.tocsenapp.TocsenJSIPackage.getJSIModules+248)
  #00  pc 0000000000221504  /data/app/~~Ol5ZwGOSXUlQuQ9Tf5g5zQ==/com.tocsenapp-qOqecHj6GFz8FSakchzmVA==/oat/arm64/base.odex (com.facebook.react.ReactInstanceManager.createReactContext+4068)
  #00  pc 000000000021e5c8  /data/app/~~Ol5ZwGOSXUlQuQ9Tf5g5zQ==/com.tocsenapp-qOqecHj6GFz8FSakchzmVA==/oat/arm64/base.odex (com.facebook.react.ReactInstanceManager$5.run+1544)
  #00  pc 000000000015ce98  /apex/com.android.art/javalib/arm64/boot.oat (java.lang.Thread.run+72)
  #00  pc 0000000000135564  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548)
  #00  pc 00000000001ab7e8  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
  #00  pc 0000000000567e94  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+460)
  #00  pc 00000000005b8184  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1308)
  #00  pc 00000000000b10e8  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+64)
  #00  pc 0000000000050a58  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)```

</details>

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 25 (12 by maintainers)

Most upvoted comments

I can now add one more insight, from our customer support we got confirmed that a reinstallation of the app helped to resolve the issue at least for the moment

with further investigation over the last days we could narrow it down to be related to code-push. My assumption is that there is some race condition or conflict when the bundle is changed and the app restarted

Is there any fix you have found for this?

For the logs: Should be fixed with 2.0.0

with further investigation over the last days we could narrow it down to be related to code-push. My assumption is that there is some race condition or conflict when the bundle is changed and the app restarted