Comments (26)
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.
@Cristian05 this package does not work with expo.
from react-native-mmkv.
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.
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.
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.
from react-native-mmkv.
This appears to have solved our issues. Will know more over the coming days.
from react-native-mmkv.
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.
@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.
@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.
please let me know if I can provide any more help.
from react-native-mmkv.
So apparently all of this happens when Hot-Reloading, not normally when starting.
from react-native-mmkv.
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.
when installing with reanimated 2, do we need to replace this ?
protected JSIModulePackage getJSIModulePackage() {
return new ReanimatedJSIModulePackage();
}
from react-native-mmkv.
On which MMKV version are you? You need 1.1.6
from react-native-mmkv.
@mrousavy ^1.1.6
yes.
from react-native-mmkv.
@alexreyes the library is not supported by expo.
from react-native-mmkv.
@a-eid did you find how to resolve your issue somehow?
from react-native-mmkv.
I have same issue! How to resolve this?
from react-native-mmkv.
It should be noted, this will also appear when using Codepush from Microsoft App Center.
from react-native-mmkv.
@jesseproudman could you elaborate? I am using CodePush and MMKV works fine for me.
from react-native-mmkv.
@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.
@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.
could anyone test if the changes in #92 fix this issue?
from react-native-mmkv.
@mrousavy giving this a go. thanks!
from react-native-mmkv.
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)
- A lot of logs even in production builds HOT 8
- Make `Set` and `Get` method consistent HOT 6
- Error: react-native-mmkv is not supported in Expo Go! Use EAS HOT 5
- com.facebook.react.JavaScript (17): EXC_BAD_ACCESS (code=1, address=0xcf9b17) from bytes[m_position++]; HOT 2
- EXC_BAD_ACCESS on IOS with codepush restart
- detox throws error when metro is run with mocks HOT 2
- mmkv관련 로그 발생 해결
- iOS crash: malloc: *** error for object 0x282611260: pointer being freed was not allocated EXC_CRASH (SIGABRT)
- Crash reports after switching to use AppGroups due to 0xdead10cc HOT 2
- Cannot run in react-native 0.73.x HOT 1
- use expo go ,start with this error: CommandError: No development build (com.anonymous.***) for this project is installed. Please make and install a development build on the device first. HOT 3
- Unable to resolve module ./createMMKV.mock HOT 1
- Apple Privacy Manifest HOT 6
- Unable to make react-native-mmkv work with firebase auth persistence HOT 2
- duplicate symbols when used with react-native-quick-crypto HOT 1
- Storage breaks when calling storage.clearStore() on empty storage HOT 1
- `getString` fails on reload after calling `delete` with `encyptionKey` set in config HOT 7
- Crashing on bundle reload in beta version HOT 1
- Bug on RN 0.74 HOT 10
- How to Implement iCloud Sync to Keep Reinstalled Apps to Recover Data?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-mmkv.