react-native: Android app crashes on RN 0.60.5 with Hermes enabled

Steps To Reproduce

  1. Build the app in the release mode with enableHermes flag set to true
  2. After successful build launch the app and observe Unfortunately, [app name] has stopped

The following error is logged out:

08-22 16:36:24.564  1467  1535 E AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
08-22 16:36:24.564  1467  1535 E AndroidRuntime: Process: com.myapp.react.android.beta, PID: 1467
08-22 16:36:24.564  1467  1535 E AndroidRuntime: com.facebook.react.common.JavascriptException: Cannot read property 'prototype' of undefined, js engine: hermes, stack:
08-22 16:36:24.564  1467  1535 E AndroidRuntime: anonymous@1:180603
08-22 16:36:24.564  1467  1535 E AndroidRuntime: v@1:149593
08-22 16:36:24.564  1467  1535 E AndroidRuntime: d@1:149286
08-22 16:36:24.564  1467  1535 E AndroidRuntime: o@1:148914
08-22 16:36:24.564  1467  1535 E AndroidRuntime: anonymous@1:180235
08-22 16:36:24.564  1467  1535 E AndroidRuntime: v@1:149593
08-22 16:36:24.564  1467  1535 E AndroidRuntime: d@1:149286
08-22 16:36:24.564  1467  1535 E AndroidRuntime: o@1:148914
08-22 16:36:24.564  1467  1535 E AndroidRuntime: anonymous@1:179628
08-22 16:36:24.564  1467  1535 E AndroidRuntime: v@1:149593
08-22 16:36:24.564  1467  1535 E AndroidRuntime: d@1:149286
08-22 16:36:24.564  1467  1535 E AndroidRuntime: o@1:148914
08-22 16:36:24.564  1467  1535 E AndroidRuntime: anonymous@1:155643
08-22 16:36:24.564  1467  1535 E AndroidRuntime: v@1:149593
08-22 16:36:24.564  1467  1535 E AndroidRuntime: d@1:149243
08-22 16:36:24.564  1467  1535 E AndroidRuntime: o@1:148914
08-22 16:36:24.564  1467  1535 E AndroidRuntime: global@1:148646
08-22 16:36:24.564  1467  1535 E AndroidRuntime:
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:739)
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:148)
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
08-22 16:36:24.564  1467  1535 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:818)
08-22 16:36:24.566   602  2039 W ActivityManager:   Force finishing activity com.myapp.react.android.beta/uk.co.myorg.myapp.ui.splash.SplashScreenActivity
08-22 16:36:24.659   602   651 I OpenGLRenderer: Initialized EGL, version 1.4
08-22 16:36:24.680  1467  1467 E WindowManager:
08-22 16:36:24.680  1467  1467 E WindowManager: android.view.WindowLeaked: Activity com.myapp.react.android.beta.MainActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{b436d8f V.E...... R....... 0,0-1200,1920} that was originally added here
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.view.ViewRootImpl.<init>(ViewRootImpl.java:368)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:299)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.app.Dialog.show(Dialog.java:319)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at org.devio.rn.splashscreen.SplashScreen$1.run(SplashScreen.java:36)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.app.Activity.runOnUiThread(Activity.java:5524)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at org.devio.rn.splashscreen.SplashScreen.show(SplashScreen.java:27)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at com.myapp.react.android.beta.MainActivity.onCreate(MainActivity.java:14)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.app.Activity.performCreate(Activity.java:6251)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.app.ActivityThread.-wrap11(ActivityThread.java)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.os.Handler.dispatchMessage(Handler.java:102)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.os.Looper.loop(Looper.java:148)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at android.app.ActivityThread.main(ActivityThread.java:5417)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at java.lang.reflect.Method.invoke(Native Method)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-22 16:36:24.680  1467  1467 E WindowManager: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Although the build is successful I can see a lot of warnings being printed out:

> Task :app:bundleReleaseJsAndAssets
Loading dependency graph, done.
info Writing bundle output to:, /path-to-my-repo/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /path-to-my-repo/android/app/build/intermediates/sourcemaps/react/release/index.android.bundle.packager.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 700 asset files
info Done copying assets
/path-to-my-repo/android/app/build/generated/assets/react/release/index.android.bundle:7:113: warning: the variable "Intl" was not declared in function " 26#"
__d(function(g,r,i,a,m,e,d){"use strict";var l,u=(l=r(d[0]))&&l.__esModule?l:{default:l};if('undefined'==typeof Intl)void 0!==g?g.Intl={PluralRules:u.default}:'undefined'!=typeof window?window.Intl={PluralRules:u.default}:(void 0).Intl={PluralRules:u.default};else if(Intl.PluralRules){var t=['en','es','ru','zh'];Intl.PluralRules.supportedLocalesOf(t).length<t.length&&(Intl.PluralRules=u.default)}else Intl.PluralRules=u.default},1,[2]);

The warning: the variable "XXX" was not declared in function repeats then several times for the following variables:

  • Intl
  • navigator
  • DebuggerInternal
  • __REACT_DEVTOOLS_GLOBAL_HOOK__
  • nativeFabricUIManager
  • setImmediate
  • Worker
  • fetch
  • FileReader
  • Blob
  • FormData
  • URLSearchParams
  • XMLHttpRequest
  • requestAnimationFrame
  • cancelAnimationFrame
  • performance
  • MessageChannel
  • clearImmediate
  • isOrientationLockedInSettings
  • SC_DISABLE_SPEEDY
  • __webpack_nonce__
  • path
  • File
  • event
  • ResourceInUse
  • OverconstrainedError

React Native version:

System:
    OS: macOS 10.14.4
    CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
    Memory: 99.21 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 8.10.0 - ~/.nvm/versions/node/v8.10.0/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v8.10.0/bin/npm
    Watchman: 4.7.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 26, 27, 28, 29
      Build Tools: 25.0.0, 26.0.2, 27.0.2, 27.0.3, 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.0 AI-171.4443003
    Xcode: 10.2/10E125 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6
    react-native: 0.60.5 => 0.60.5
  npmGlobalPackages:
    react-native-generate: 0.1.0
    react-native-git-upgrade: 0.2.7

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 31
  • Comments: 23

Commits related to this issue

Most upvoted comments

Same issue here, how to fix this please?

I am also experiencing the warning of warning: the variable "XXX" was not declared in function, except the build completes successfully and the app appears to run properly, though I am concerned about what potential effects this has that I am missing.

I’m on React Native 0.61.2, and I get this warning for the following variables:

  • "DebuggerInternal" was not declared in function "s 4#"
  • "clearTimeout" was not declared in function "componentWillUnmount 1#"
  • "setTimeout" was not declared in function "touchableHandleResponderGrant"
  • "__REACT_DEVTOOLS_GLOBAL_HOOK__" was not declared in function "Cl"
  • "nativeFabricUIManager" was not declared in function " 443#"
  • "setImmediate" was not declared in function "h 4#"
  • "Worker" was not declared in function " 508#"
  • "fetch" was not declared in function " 570#"
  • "Headers" was not declared in function " 570#"
  • "Request" was not declared in function " 570#"
  • "Response" was not declared in function " 570#"
  • "FileReader" was not declared in function "p 12#"
  • "Blob" was not declared in function " 579#"
  • "FormData" was not declared in function " 579#"
  • "URLSearchParams" was not declared in function " 579#"
  • "XMLHttpRequest" was not declared in function " 586#"
  • "MessageChannel" was not declared in function " 683#"
  • "clearImmediate" was not declared in function " 762#"
  • "requestAnimationFrame" was not declared in function "value 348#"
  • "cancelAnimationFrame" was not declared in function "componentWillUnmount 3#"
  • "__g" was not declared in function " 1543#"
  • "__e" was not declared in function " 1544#"
  • "postMessage" was not declared in function "n 93#"
  • "document" was not declared in function " 1582#"
  • "PromiseRejectionEvent" was not declared in function " 1584#"
  • "clearInterval" was not declared in function "p 34#"
  • "setInterval" was not declared in function "update"

Any update on this?

Hello. Still exist with 0.63.2.

RNv0.63.2 still facing the issue. Any word on this?

any fix? v0.62.2 still facing issue