Running an app which includes AsyncStorage from this package instead of react-native will crash the app on startup.
It doesn't crash the app on startup.
Just include the package with any RN > 0.58 (I think with all the gradle upgrades coming in 0.58 as well)
This is the log from the production device / emulator:
2019-03-20 16:21:35.950 9719-9742/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.bundlenam, PID: 9719
com.facebook.react.common.JavascriptException: null is not an object (evaluating 'l.multiMerge'), stack:
<unknown>@1436:2386
_@2:1514
d@2:967
o@2:435
<unknown>@1435:298
_@2:1514
d@2:967
o@2:435
<unknown>@1434:447
_@2:1514
d@2:967
o@2:435
<unknown>@1428:293
_@2:1514
d@2:967
o@2:435
<unknown>@1420:875
_@2:1514
d@2:967
o@2:435
<unknown>@1419:207
_@2:1514
d@2:967
o@2:435
<unknown>@1418:164
_@2:1514
d@2:967
o@2:435
<unknown>@1414:345
_@2:1514
d@2:967
o@2:435
<unknown>@1413:164
_@2:1514
d@2:967
o@2:435
<unknown>@358:416
_@2:1514
d@2:967
o@2:435
<unknown>@11:71
_@2:1514
d@2:897
o@2:435
global code@1618:4
at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:164)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:764)
2019-03-20 16:24:15.347 9940-9963/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.bundlename, PID: 9940
com.facebook.react.common.JavascriptException: null is not an object (evaluating 'l.multiMerge'), stack:
<unknown>@1436:2386
_@2:1514
d@2:967
o@2:435
<unknown>@1435:298
_@2:1514
d@2:967
o@2:435
<unknown>@1434:447
_@2:1514
d@2:967
o@2:435
<unknown>@1428:293
_@2:1514
d@2:967
o@2:435
<unknown>@1420:875
_@2:1514
d@2:967
o@2:435
<unknown>@1419:207
_@2:1514
d@2:967
o@2:435
<unknown>@1418:164
_@2:1514
d@2:967
o@2:435
<unknown>@1414:345
_@2:1514
d@2:967
o@2:435
<unknown>@1413:164
_@2:1514
d@2:967
o@2:435
<unknown>@358:416
_@2:1514
d@2:967
o@2:435
<unknown>@11:71
_@2:1514
d@2:897
o@2:435
global code@1618:4
at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:164)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:764)
@mxmzb Hey, thanks for reporting this!
Can you confirm that you linked the package using react-native link @react-native-community/async-storage and reinstalled the app?
@Krizzu Sure! Yes, I did link and reinstall.
@mxmzb I created new project with version 59 and I see no issue with Async Storage.
Does it happen on multiMerge/mergeItem call?
@Krizzu I don't explicitly call these methods in my app, just having the package imported crashes my app. I will have another look at whether it maybe depends on some other config that I've set, maybe it's some babel plugin.
Right, thanks @mxmzb .
This one is interesting to debug - I could use some more info about your setup to replicate it.
I am having the same issue. When using AsyncStorage from 'react-native' it works fine, as soon as I import AsyncStorage from '@react-native-community/async-storage' the app crashes (before any call is made to AsyncStorage itself). My dependencies are:
"dependencies": {
"@react-native-community/async-storage": "^1.2.1",
"axios": "^0.18.0",
"date-fns": "^1.30.1",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.11",
"react": "16.8.3",
"react-native": "0.59.1",
"react-native-firebase": "^5.2.3",
"react-native-gesture-handler": "^1.1.0",
"react-native-material-ui": "^1.30.1",
"react-native-sensitive-info": "^5.3.0",
"react-native-vector-icons": "^6.4.1",
"react-navigation": "^3.3.2",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/runtime": "^7.3.4",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.5.0",
"babel-preset-react-native": "^4.0.1",
"eslint": "^5.15.1",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.12.4",
"jest": "^24.5.0",
"metro-react-native-babel-preset": "^0.53.1",
"react-native-dotenv": "^0.2.0",
"react-test-renderer": "16.8.3"
},
/android/build.grable change:targetSdkVersion = 27 to targetSdkVersion = 28
classpath 'com.android.tools.build:gradle:3.2.1' to classpath 'com.android.tools.build:gradle:3.3.1'
targetSdkVersion = 27 to targetSdkVersion = 28
and remove task wrapper function
/android/app/build.grable change:add function after buildToolsVersion rootProject.ext.buildToolsVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
change include "armeabi-v7a", "x86", "arm64-v8a" to include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
change def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3] to def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
/android/gradle/wrapper/gradle-wrapper.propertieschange distributionUrl to https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
@mxmzb @LadislavBohm
Still, I cannot repro this - importing AS from RN, then from community's package is not crashing for me.
What about clearing packager cache with react-native start --resetCache?
@voroncv I'm not convinced that gradle version has anything to do with JS bundling here, but thanks for your input.
Experiencing the same issue with RN0.59 running on a Nexus 5 emulator.
Currently only using .setItem, .getItem and .removeItem.
Reverting back to import {AsyncStorage} from "react-native" for the moment.
Oops, GH closed the issue - reopening for further discussion.
Let me know if latest release have fixed the issue.
@Krizzu The release note for v1.2.2 doesn't discuss any thing specific to the issue.
Works for me with RN 0.59.2 and store 1.2.2
@mifi Good you got it working.
If anyone need more help, please re-open this issue.
Also, please make sure you post additional info, like repro steps or things you've already tried, so it'd be easier to find the root cause.
thanks.
I'm having the same issue on Android. It simply just doesn't run and crashes (freezes) on the splash screen.
Using RN 0.59.2. Looks like I gotta go back to the original version.
I think I believe I found the issue.
Using auto link, react-native link :
react-native link @react-native-community/async-storage
(in my code) has a bug and doesn't add the code in the section
protected List
new AsyncStoragePackage()
in MainApplication.java
If you follow the manual way:
https://github.com/react-native-community/react-native-async-storage/blob/master/docs/Linking.md
...should be good to go:
I'm happy to see you got it working @tkoolreact. When you react-native link fails, you should be notified about it. Did you get any errors/warnings? Maybe it's something that's worth pointing out in https://github.com/react-native-community/cli ?
thanks.
Same issue here. App crashes on open, on both platforms, IOS and Android. RN version 0.59.9.
@leandrosimoes
I'd need more info to know why it's crashing
Seeing the same issue on startup in version 0.59.8. I am using "AsyncStorage" from react-native.
com.facebook.react.common.JavascriptException: null is not an object (evaluating 'u.multiMerge'), stack:
<unknown>@359:2250
h@2:1670
<unknown>@419:65
h@2:1670
<unknown>@418:124
h@2:1670
<unknown>@12:177
h@2:1670
<unknown>@11:43
h@2:1670
d@2:868
global code@1665:4
at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:214)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:919)
Most helpful comment
Experiencing the same issue with RN0.59 running on a Nexus 5 emulator.
Currently only using .setItem, .getItem and .removeItem.
Reverting back to import {AsyncStorage} from "react-native" for the moment.