【问题标题】:ReferenceError: Can't find variable: Intl (Android Expo)ReferenceError: 找不到变量: Intl (Android Expo)
【发布时间】:2023-01-19 12:53:03
【问题描述】:

我正在使用 Expo 开发 React Native 应用程序。 我在 Android 中使用我的应用程序时遇到问题,因为总是向我发送相同的错误消息:

ReferenceError: Can't find variable: Intl

看了很多帖子,还是遇到同样的问题

"react-native": "0.68.2",
"expo": "^45.0.6",
"native-base": "^3.4.15",

这是我的/android/app/build.gradle

 def jscFlavor = 'org.webkit:android-jsc-intl:+'

 if (enableHermes) {
     ...
 } else {
     implementation jscFlavor
 }

【问题讨论】:

    标签: android react-native expo intl


    【解决方案1】:

    如果enableHermes 为真,您可以尝试此解决方案。

    If disabling Hermes is not an option in your app/build.gradle, and you cant use

    【讨论】:

    • 这可能是一个选项,但我的应用程序中有大约 30 种语言。我必须添加每一个进口?因为我在初始化 i18n 时就有了它们。也许还有另一种方法可以在没有 Intl 的情况下执行 NumberFormat?或者使用 i18nNext?
    【解决方案2】:

    编辑:

    我注意到 jsc-android-buildscripts 支持世博会如果您使用的是 expo,则可能不需要安装它。我卸载它并且它有效。抱歉,这可能不是答案,但我会把它留给可能与我有同样问题的其他人

    你有安装this吗?我想使用Luxon,我得到了和你一样的错误,然后注意到他们推荐使用jsc-android-buildscripts

    我的问题是我的/android/app/build.gradlejscFlavor被设置为'org.webkit:android-jsc:+'

    【讨论】:

    • 谢谢@Adam 我试过配置 jsc-android-buildscript 但没有成功
    【解决方案3】:

    您找到解决此问题的方法了吗?我现在遇到了同样的问题 react-native@0.70

    【讨论】:

      猜你喜欢
      • 2021-05-02
      • 1970-01-01
      • 1970-01-01
      • 2014-02-20
      • 2018-04-24
      • 2016-10-30
      • 2012-03-18
      • 2015-11-16
      • 2011-05-22
      相关资源
      最近更新 更多