Git Product home page Git Product logo

Comments (26)

alexreyes avatar alexreyes commented on May 18, 2024 3

Can also confirm that the latest version doesn't work with Expo. If this library got Expo support it would be amazing

from react-native-mmkv.

a-eid avatar a-eid commented on May 18, 2024 2

@Cristian05 this package does not work with expo.

from react-native-mmkv.

a-eid avatar a-eid commented on May 18, 2024 2

also the app failed building on android

> Task :app:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
290 actionable tasks: 271 executed, 19 up-to-date
Note: /Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: [2] Wrote GeneratedAppGlideModule with: [com.bumptech.glide.integration.okhttp3.OkHttpLibraryGlideModule, com.dylanvann.fastimage.FastImageOkHttpProgressGlideModule]
Note: /Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/react-native-geolocation-service/android/src/main/java/com/agontuk/RNFusedLocation/LocationUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/@react-native-picker/picker/android/src/main/java/com/reactnativecommunity/picker/ReactPickerManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/@sentry/react-native/android/src/main/java/io/sentry/react/RNSentryModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Users/ahmedeid/zeal/alsagheer-app-reactnative/android/app/src/main/java/com/alsagheer/AlsagheerJSIPackage.java:5: error: package com.reactnativemmkv does not exist
import com.reactnativemmkv.MmkvModule;
                          ^
/Users/ahmedeid/zeal/alsagheer-app-reactnative/android/app/src/main/java/com/alsagheer/MainApplication.java:44: error: cannot find symbol
            return new AlsagheerJSIPackage();
                       ^
  symbol: class AlsagheerJSIPackage
/Users/ahmedeid/zeal/alsagheer-app-reactnative/android/app/src/main/java/com/alsagheer/AlsagheerJSIPackage.java:16: error: cannot find symbol
        MmkvModule.install(jsContext, reactApplicationContext.getFilesDir().getAbsolutePath() + "/mmkv");
        ^
  symbol:   variable MmkvModule
  location: class AlsagheerJSIPackage
Note: /Users/ahmedeid/zeal/alsagheer-app-reactnative/android/app/src/debug/java/com/alsagheer/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 16s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: /Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: [2] Wrote GeneratedAppGlideModule with: [com.bumptech.glide.integration.okhttp3.OkHttpLibraryGlideModule, com.dylanvann.fastimage.FastImageOkHttpProgressGlideModule]
Note: /Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/react-native-geolocation-service/android/src/main/java/com/agontuk/RNFusedLocation/LocationUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/@react-native-picker/picker/android/src/main/java/com/reactnativecommunity/picker/ReactPickerManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/@sentry/react-native/android/src/main/java/io/sentry/react/RNSentryModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Users/ahmedeid/zeal/alsagheer-app-reactnative/android/app/src/main/java/com/alsagheer/AlsagheerJSIPackage.java:5: error: package com.reactnativemmkv does not exist
import com.reactnativemmkv.MmkvModule;
                          ^
/Users/ahmedeid/zeal/alsagheer-app-reactnative/android/app/src/main/java/com/alsagheer/MainApplication.java:44: error: cannot find symbol
            return new AlsagheerJSIPackage();
                       ^
  symbol: class AlsagheerJSIPackage
/Users/ahmedeid/zeal/alsagheer-app-reactnative/android/app/src/main/java/com/alsagheer/AlsagheerJSIPackage.java:16: error: cannot find symbol
        MmkvModule.install(jsContext, reactApplicationContext.getFilesDir().getAbsolutePath() + "/mmkv");
        ^
  symbol:   variable MmkvModule
  location: class AlsagheerJSIPackage
Note: /Users/ahmedeid/zeal/alsagheer-app-reactnative/android/app/src/debug/java/com/alsagheer/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 16s

    at makeError (/Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/execa/index.js:174:9)
    at /Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async runOnAllDevices (/Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
    at async Command.handleAction (/Users/ahmedeid/zeal/alsagheer-app-reactnative/node_modules/@react-native-community/cli/build/index.js:186:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

from react-native-mmkv.

mrousavy avatar mrousavy commented on May 18, 2024 1

Just open your project (.xcworkspace) in Xcode, press Command + Shift + O, search for "Mmkv" and open the Mmkv.mm file. then scroll to the line I linked, click the line number at the left and run the app from Xcode. it will pause execution at the breakpoint.

from react-native-mmkv.

mrousavy avatar mrousavy commented on May 18, 2024 1

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 👍

from react-native-mmkv.

a-eid avatar a-eid commented on May 18, 2024 1

Screen Shot 2021-03-27 at 5 46 12 AM

from react-native-mmkv.

jesseproudman avatar jesseproudman commented on May 18, 2024 1

This appears to have solved our issues. Will know more over the coming days.

from react-native-mmkv.

mrousavy avatar mrousavy commented on May 18, 2024

MMKV is being initialized as soon as the bridge is being set (see here), afaik that is before JS code can be executed so it shouldn't be undefined. Could you try adding a breakpoint there to see what gets executed first?

from react-native-mmkv.

a-eid avatar a-eid commented on May 18, 2024

@mrousavy sorry, I'm not really sure how to do that, but will try and report back if I am successful.

from react-native-mmkv.

a-eid avatar a-eid commented on May 18, 2024

@mrousavy it does hit the [MMKV initializeMMKV:nil]; line while on the native splash screen.

this log might be helpful.

[Tue Mar 09 2021 15:50:18.718]  LOG      Running "overlay/splash" with {"rootTag":31,"initialProps":{"componentId":"Component1"}}
[Tue Mar 09 2021 15:50:18.862]  WARN     Possible Unhandled Promise Rejection (id: 0):
TypeError: _reactNativeMmkv.MMKV.getString is not a function. (In '_reactNativeMmkv.MMKV.getString(TOKEN_KEY)', '_reactNativeMmkv.MMKV.getString' is undefined)
getToken@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:102145:43
_callee$@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:103078:41
tryCatch@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:1444:23
invoke@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:1617:32
tryCatch@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:1444:23
invoke@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:1517:30
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:1527:21
tryCallOne@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:6438:16
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:6539:27
_callTimer@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:30977:17
_callImmediatesPass@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:31016:17
callImmediates@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:31233:33
__callImmediates@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:5732:35
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:5518:34
__guard@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:5715:15
flushedQueue@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:5517:21
flushedQueue@[native code]
invokeCallbackAndReturnFlushedQueue@[native code]

I'm not sure why it says, Possible Unhandled Promise Rejection (id: 0):.

from react-native-mmkv.

a-eid avatar a-eid commented on May 18, 2024

please let me know if I can provide any more help.

from react-native-mmkv.

mrousavy avatar mrousavy commented on May 18, 2024

So apparently all of this happens when Hot-Reloading, not normally when starting.

from react-native-mmkv.

crisfcodes avatar crisfcodes commented on May 18, 2024

I'm getting the similar error in expo app:

TypeError: _reactNativeMmkv.MMKV.getString is not a function. (In
 '_reactNativeMmkv.MMKV.getString(name)', '_reactNativeMmkv.MMKV.
getString' is undefined)

expo is supported?

from react-native-mmkv.

a-eid avatar a-eid commented on May 18, 2024

when installing with reanimated 2, do we need to replace this ?

protected JSIModulePackage getJSIModulePackage() {
   return new ReanimatedJSIModulePackage();
}

from react-native-mmkv.

mrousavy avatar mrousavy commented on May 18, 2024

On which MMKV version are you? You need 1.1.6

from react-native-mmkv.

a-eid avatar a-eid commented on May 18, 2024

@mrousavy ^1.1.6 yes.

from react-native-mmkv.

a-eid avatar a-eid commented on May 18, 2024

@alexreyes the library is not supported by expo.

from react-native-mmkv.

yelnar avatar yelnar commented on May 18, 2024

@a-eid did you find how to resolve your issue somehow?

from react-native-mmkv.

etomarat avatar etomarat commented on May 18, 2024

I have same issue! How to resolve this?

from react-native-mmkv.

jesseproudman avatar jesseproudman commented on May 18, 2024

It should be noted, this will also appear when using Codepush from Microsoft App Center.

from react-native-mmkv.

mrousavy avatar mrousavy commented on May 18, 2024

@jesseproudman could you elaborate? I am using CodePush and MMKV works fine for me.

from react-native-mmkv.

jesseproudman avatar jesseproudman commented on May 18, 2024

@mrousavy Absolutely.

We've got a React-Native 0.64 app deployed via Test Flight, integrated with Appcenter / Codepush.

We're seeing frequent exceptions being raised on app boot:

TypeError: f.MMKV.getString is not a function. (In 'f.MMKV.getString("veriff-status")', 'f.MMKV.getString' is undefined)

Many of these seem to be post a Codepush update which I would assume triggers hot reloading. Many of them also just appear on first boot based on the time stamps in the logs:

08:29:47 / Running "app" with {"rootTag":1,"initialProps":{}}
08:29:47 / [CodePush] Checking for update.
08:29:47 / TypeError: t.MMKV.getString is not a function. (In 't.MMKV.getString("user-email")', 't.MMKV.getString' is undefined)

Would be super interested if you have any ideas on how to debug given yours is working. :)

from react-native-mmkv.

sauldom102 avatar sauldom102 commented on May 18, 2024

@mrousavy I'm running into the same problem as @jesseproudman, we're not using Expo, just react-native-unimodules, it's really annoying having these random crashes, probably as you said it's due to some race condition, any help would be appreciated, thanks in advance!

from react-native-mmkv.

mrousavy avatar mrousavy commented on May 18, 2024

could anyone test if the changes in #92 fix this issue?

from react-native-mmkv.

jesseproudman avatar jesseproudman commented on May 18, 2024

@mrousavy giving this a go. thanks!

from react-native-mmkv.

jesseproudman avatar jesseproudman commented on May 18, 2024

Just wanted to close the loop - We have not seen this particular error occur in production with this patch active.

from react-native-mmkv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.