FidMe / react-native-fast-storage

A simple, performance oriented key value storage for React Native. Drop in replacement for AsyncStorage
88 stars 13 forks source link

[Android] Should Initialize MMKV from MainActivity #12

Open keShraa opened 3 years ago

keShraa commented 3 years ago

[ANDROID] Removed setupLibrary (MMKV.initialize method) from React Native logic.

Now you should init MMKV from your own MainActivity file and don't forget to import implementation 'com.tencent:mmkv-static:1.2.10' in your app/build.gradle

By doing so, we are trying to avoid a crash caused by the MMKV.initialize method.

Fatal Exception: java.lang.RuntimeException: Could not invoke RNFastStorage.setupLibrary

   at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:383)
   at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)
   at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
   at android.os.Handler.handleCallback(Handler.java:873)
   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:214)
   at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
   at java.lang.Thread.run(Thread.java:764)