【问题标题】:React-Native APK still running in dev modeReact-Native APK 仍在开发模式下运行
【发布时间】:2017-03-19 07:44:47
【问题描述】:

我已经完成了使用 React-Native 为 Android 开发的小应用程序。捆绑过程来了,根据文档如下(将 dev 设置为 false):

sudo react-native bundle --platform android --dev false --entry-file index.android.js \
  --bundle-output android/app/src/main/assets/index.android.bundle \
  --assets-dest android/app/src/main/res/

然后组装我的版本:

cd android && ./gradlew assembleRelease

签署应用程序,对其进行压缩对齐,然后就是我的最终 APK。 但是,当我的 Bugsnag 库发现错误时,我在 错误的堆栈跟踪:

at Object.touchableHandlePress (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:29456

我清楚地看到 dev 仍然设置为 true。 这让我想到了我的问题,如下所示:我的 APK 是否仍在开发模式下运行?或者它是 Bugsnag 的一个特性,显示这样的错误路径?如果没有,我该如何将其设置为 false?

谢谢。

【问题讨论】:

    标签: android node.js react-native


    【解决方案1】:

    如需了解更多详情:您在哪里运行 APK?在设备中还是在模拟器中?

    您是否尝试过直接在设备上安装(正在安装: cd android && ./gradlew installRelease && cd -正在运行: react-native run-android --configuration=release)?尽管您已经制作了 APK,但您似乎正在针对 localhost 运行开发版本。

    另外,您可以将 __DEV__ 作为属性发送给 Bugsnag,以查看它是真还是假(以消除这种“Bugsnag 的特殊性”的可能性)。

    【讨论】:

    • 我确实在设备上运行。我也尝试通过“adb install -r path/to/apk”安装 APK。你如何建议我把这处房产寄给 Bugsnag?你有点把我弄丢了。
    • 例如:this.client.notify(error, (report) => { report.inDevMode = __DEV__; });(参见:docs.bugsnag.com/platforms/react-native/…
    • 发送这样的错误时,bundle 路径看起来像这样 'index.android.bundle:12 componentWillMount' 好吧,现在我很困惑。
    猜你喜欢
    • 1970-01-01
    • 2019-04-25
    • 2017-04-07
    • 2021-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-14
    • 2021-06-07
    相关资源
    最近更新 更多