ammarahm-ed / react-native-mmkv-storage

An ultra fast (0.0002s read/write), small & encrypted mobile key-value storage framework for React Native written in C++ using JSI
https://rnmmkv.now.sh
MIT License
1.56k stars 109 forks source link

App Crash on Android 12+ #312

Open mohity777 opened 1 year ago

mohity777 commented 1 year ago

Describe the bug App gets crash as soon as app is launched

To Reproduce Steps to reproduce the behavior:

  1. Install react-native-mmkv-storage 0.8.0
  2. Run App using react-native run-android
  3. Open App

Expected behavior App should not crash

Screenshots FATAL EXCEPTION: create_react_context Process: in.mohalla.video, PID: 5585 java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~_YMS11acemf79gjweO5uNw==/in.mohalla.video-SHk_u7uZtPzBaImcJ_rWJQ==/lib/arm64/librnmmkv.so"... at java.lang.Runtime.loadLibrary0(Runtime.java:1077) at java.lang.Runtime.loadLibrary0(Runtime.java:998) at java.lang.System.loadLibrary(System.java:1661) at com.ammarahmed.mmkv.RNMMKVModule.(RNMMKVModule.java:38) at com.ammarahmed.mmkv.RNMMKVPackage.createNativeModules(RNMMKVPackage.java:17) at com.facebook.react.ReactPackageHelper.getNativeModuleIterator(ReactPackageHelper.java:42) at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:42) at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1425) at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1396) at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1287) at com.facebook.react.ReactInstanceManager.access$1100(ReactInstanceManager.java:136) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1065) at java.lang.Thread.run(Thread.java:1012)

Screenshot 2023-02-04 at 11 34 02 PM

Platform Information:

Additional context I tried its alternative library react-native-mmkv that one is also crashing on android 12+. related issue: 1) https://github.com/mrousavy/react-native-mmkv/issues/487 2) https://github.com/facebook/react-native/issues/35324

rdjuric commented 1 year ago

I was having the same problem when updating from react-native 0.67.5 -> 0.72.3 using mmkv 0.8.0.

The problem on my case was that even thought I had ndkVersion = "23.1.7779620" on build.gradle, I was also setting it manually on /android/.localproperties to be version 21.x, like this ndk.dir=C:\\Users\\Name\\AppData\\Local\\Android\\Sdk\\ndk\\21.x.xx

Changing this to match the version on build.grade (23.1.7779620) and then deleting the version 21 on the SDK manager solved the issue for me.