Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M.MMKC.delete is not a function - Android Release Mode #29

Closed
1 of 4 tasks
linzera opened this issue Mar 15, 2021 · 13 comments
Closed
1 of 4 tasks

M.MMKC.delete is not a function - Android Release Mode #29

linzera opened this issue Mar 15, 2021 · 13 comments

Comments

@linzera
Copy link

linzera commented Mar 15, 2021

Our app is live in-store with this behavior, any help?

Current behavior

MMKV functions are undefined.

Expected behavior

Should work properly, functions should not be undefined.

Environment

  • Platforms tested:
    • Android
    • iOS
    • macOS
    • Windows
  • MMKV version: 1.0.6
  • Environment:

System:
OS: macOS 10.15.7
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 1.97 GB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.15.1 - ~/.nvm/versions/node/v14.15.1/bin/node
Yarn: 1.22.10 - ~/pegacredito/PegaCredito/node_modules/.bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.15.1/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.0 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK:
API Levels: 23, 28, 29, 30
Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.0
System Images: android-18 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
Android NDK: 22.0.7026061
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3

@mrousavy
Copy link
Owner

M.MMKC.delete is not a function

is that actually the error? I don't think I had a typo in there 🤨

@mrousavy
Copy link
Owner

Okay just checked out the logs, I'm wondering what the prefix means? (aka the s. in s.MMKV.set) Is that just a thing Sentry does or is there something wrong with the import?

@mrousavy
Copy link
Owner

Also, please create a reproduceable sample app for this, I have no way of debugging that. Can you absolutely not reproduce it in debug mode? Maybe try upgrading react-native to 0.64?

@linzera
Copy link
Author

linzera commented Mar 15, 2021

Okay just checked out the logs, I'm wondering what the prefix means? (aka the s. in s.MMKV.set) Is that just a thing Sentry does or is there something wrong with the import?

Sentry does this. Sorry for the small debug information that sentry gives on share mode.

@linzera
Copy link
Author

linzera commented Mar 15, 2021

Also, please create a reproducible sample app for this, I have no way of debugging that. Can you absolutely not reproduce it in debug mode? Maybe try upgrading react-native to 0.64?

Debug works like a charm, but on release mode in this specific user, this happens, I will try to upgrade RN to see if I can catch some way to reproduce this.

@linzera
Copy link
Author

linzera commented Mar 15, 2021

More information about the crash:

AndroidAPI
image (3)

@mrousavy
Copy link
Owner

This might be related to #28 because the current way of installing the JSI bindings is a bit hacky. I'll rewrite this thing to a TurboModule, which should fix those issues.

@LadislavBohm
Copy link

This is currently happening for me even in DEBUG (Android) when I upgrade to 1.0.11. Everything works on version 1.0.10.

@mrousavy
Copy link
Owner

mrousavy commented Mar 22, 2021

Can you check if the newest version (1.1.6) works for you? Note that it requires some additional installation steps, see INSTALL.md.

Also, if you can't import the library see this issue which includes a temporary workaround. I'll find a fix that requires no native changes at all soon 👍

@chr4ss1
Copy link

chr4ss1 commented Mar 24, 2021

@mrousavy is there also a temporary workaround for iOS? I think the JSI bindings problem affect both platforms

@mrousavy
Copy link
Owner

@ChrisEelmaa I haven't seen any issues on the iOS platform, so I don't think there's something wrong there. Are you experiencing crashes?

Of course I will still migrate it to TurboModules as soon as possible.

@chr4ss1
Copy link

chr4ss1 commented Mar 24, 2021

I am not directly using this library however I have taken a look at how you install the iOS bindings as well your thread (facebook/react-native#31197), and am fairly confident that is not the correct way, as I also install the iOS bindings like that, and occasionally there is a race condition, I managed to reproduce it 2 times out of 300 or so, but essentially what I believe is happening is that the code

jsiRuntime.global().setProperty(jsiRuntime, "mmkvGet", ....);

gets executed too soon/too late sometimes, and in that case the global.mmkvGet is not available, and won't be available throughout the app

@mrousavy
Copy link
Owner

Exactly, it is not the correct way. The correct way would be by using TurboModules, but they're not fully ready yet so we have to use this JSI install workaround. If there are also race conditions for iOS I could take a look on how I can install it there, if you find something out let me know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants