Skip to content

Doesn't run on Android with RN > 0.58 #44

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

Closed
mxmzb opened this issue Mar 20, 2019 · 19 comments · Fixed by #46
Closed

Doesn't run on Android with RN > 0.58 #44

mxmzb opened this issue Mar 20, 2019 · 19 comments · Fixed by #46
Labels
bug Something isn't working platform: Android This is Android specific

Comments

@mxmzb
Copy link

mxmzb commented Mar 20, 2019

Current behavior

Running an app which includes AsyncStorage from this package instead of react-native will crash the app on startup.

Expected behavior

It doesn't crash the app on startup.

Repro steps

Just include the package with any RN > 0.58 (I think with all the gradle upgrades coming in 0.58 as well)

Environment

  • Async Storage version: 1.2.1
  • React-Native version: > 0.58
  • Platform tested: Android only, iOS works fine
  • Logs/Error that are relevant:

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)
@krizzu krizzu added bug Something isn't working platform: Android This is Android specific labels Mar 20, 2019
@krizzu
Copy link
Member

krizzu commented Mar 20, 2019

@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?

@mxmzb
Copy link
Author

mxmzb commented Mar 20, 2019

@krizzu Sure! Yes, I did link and reinstall.

@krizzu
Copy link
Member

krizzu commented Mar 20, 2019

@mxmzb I created new project with version 59 and I see no issue with Async Storage.

Does it happen on multiMerge/mergeItem call?

@mxmzb
Copy link
Author

mxmzb commented Mar 20, 2019

@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.

@krizzu
Copy link
Member

krizzu commented Mar 20, 2019

Right, thanks @mxmzb .

This one is interesting to debug - I could use some more info about your setup to replicate it.

@LadislavBohm
Copy link

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"
},

@voroncv
Copy link

voroncv commented Mar 21, 2019

My solution

In /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

In /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]

In /android/gradle/wrapper/gradle-wrapper.properties

change distributionUrl to https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

@krizzu
Copy link
Member

krizzu commented Mar 21, 2019

@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.

@seasmurph2k
Copy link

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.

@krizzu
Copy link
Member

krizzu commented Mar 26, 2019

Oops, GH closed the issue - reopening for further discussion.

Let me know if latest release have fixed the issue.

@krizzu krizzu reopened this Mar 26, 2019
@krunalsshah
Copy link

@krizzu The release note for v1.2.2 doesn't discuss any thing specific to the issue.

@mifi
Copy link
Contributor

mifi commented Apr 4, 2019

Works for me with RN 0.59.2 and store 1.2.2

@krizzu
Copy link
Member

krizzu commented Apr 7, 2019

@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.

@krizzu krizzu closed this as completed Apr 7, 2019
@tkoolreact
Copy link

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.

@tkoolreact
Copy link

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 getPackages()

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:

@krizzu
Copy link
Member

krizzu commented May 1, 2019

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.

@leandrosimoes
Copy link

Same issue here. App crashes on open, on both platforms, IOS and Android. RN version 0.59.9.

@krizzu
Copy link
Member

krizzu commented Jun 22, 2019

@leandrosimoes

I'd need more info to know why it's crashing

@aravikanti
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform: Android This is Android specific
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants