react-native: com.facebook.react.common.JavascriptException: Can't find variable: Intl

My debug builds are working perfectly fine, however, when trying to use a production build, the apk(Android) crashes with this error: com.facebook.react.common.JavascriptException: Can't find variable: Intl, stack:

Here’s the full stack trace:

05-14 16:33:42.145 18137 18176 E AndroidRuntime: com.facebook.react.common.JavascriptException: Can't find variable: Intl, stack:
05-14 16:33:42.145 18137 18176 E AndroidRuntime: <unknown>@488:88
05-14 16:33:42.145 18137 18176 E AndroidRuntime: d@2:768
05-14 16:33:42.145 18137 18176 E AndroidRuntime: n@2:409
05-14 16:33:42.145 18137 18176 E AndroidRuntime: t@2:262
05-14 16:33:42.145 18137 18176 E AndroidRuntime: <unknown>@487:171
05-14 16:33:42.145 18137 18176 E AndroidRuntime: d@2:768
05-14 16:33:42.145 18137 18176 E AndroidRuntime: n@2:409
05-14 16:33:42.145 18137 18176 E AndroidRuntime: t@2:262
05-14 16:33:42.145 18137 18176 E AndroidRuntime: <unknown>@484:191
05-14 16:33:42.145 18137 18176 E AndroidRuntime: d@2:768
05-14 16:33:42.145 18137 18176 E AndroidRuntime: n@2:409
05-14 16:33:42.145 18137 18176 E AndroidRuntime: t@2:262
05-14 16:33:42.145 18137 18176 E AndroidRuntime: <unknown>@306:411
05-14 16:33:42.145 18137 18176 E AndroidRuntime: d@2:768
05-14 16:33:42.145 18137 18176 E AndroidRuntime: n@2:409
05-14 16:33:42.145 18137 18176 E AndroidRuntime: t@2:262
05-14 16:33:42.145 18137 18176 E AndroidRuntime: <unknown>@12:42
05-14 16:33:42.145 18137 18176 E AndroidRuntime: d@2:768
05-14 16:33:42.145 18137 18176 E AndroidRuntime: n@2:339
05-14 16:33:42.145 18137 18176 E AndroidRuntime: t@2:262
05-14 16:33:42.145 18137 18176 E AndroidRuntime: global code@509:8
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:746)
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:148)
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
05-14 16:33:42.145 18137 18176 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:818)

Environment

Environment: OS: macOS High Sierra 10.13.3 Node: 10.0.0 Yarn: Not Found npm: 6.0.0 Watchman: Not Found Xcode: Xcode 9.3.1 Build version 9E501 Android Studio: 3.1 AI-173.4720617

Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: 0.55.3 => 0.55.3

Steps to Reproduce

Run ./gradlew assembleRelease, and start the app. The app crashes.

Expected Behavior

The should start just like it does in debug mode

Actual Behavior

The app crashes. There is no Intl in use in the bundle file generated

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

This will actually be fully supported in 0.60 through https://github.com/facebook/react-native/pull/24276 which adds a build flag to swap out JSC for Android.

@cpojer

This should definitely be fixed with 0.59 and the latest JSC.

I’m almost certain that 0.59 uses the non-international variant of the JSC, which means that this is still an issue. Using the International variant was discussed shortly here but there’s no record of the final decision.

Maybe it’s worth to consider adding a gradle flag (addInternationalSupport) for users that need the Intl features (I believe it’s quite common in mobile apps)?