简体   繁体   English

在 react-native Android 发布版本上查看控制台日志

[英]Viewing console logs on react-native Android release build

I'm currently facing an issue which only exists in production/release build for Android. Is it possible to run debugger or view logs for production/release builds?我目前面临的问题仅存在于 Android 的生产/发布版本中。是否可以运行调试器或查看生产/发布版本的日志?

Use console.log , console.warn , etc.使用console.logconsole.warn等。

You can try simply run the following to see logs in the console:您可以尝试简单地运行以下命令以在控制台中查看日志:

react-native log-ios
react-native log-android

Reference: https://stackoverflow.com/a/38056698/9877424参考: https://stackoverflow.com/a/38056698/9877424

Maybe this or this could help. 也许可能会有所帮助。

Try something with 尝试一下

if (__DEV__) {
    //log in dev build
} else {
   //log in product build
}

Try the following:尝试以下操作:

Run the logger for android using the following:使用以下命令运行 android 的记录器:

npx react-native log-android

Then run your app in release mode:然后以发布模式运行您的应用程序:

npx react-native run-android --variant=release

All of your console.log() and console.warn() should be displayed.您的所有 console.log() 和 console.warn() 都应该显示出来。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果debuggable = false,为什么反应本地android版本会崩溃? - Why react-native android release build crash if the debuggable=false? 在android的react-native release build中禁用minification和uglify - Disable minification and uglify in react-native release build for android react-native .58.1 无法构建 Android 版本 - react-native .58.1 cannot build Android release react-native版本发布APK失败 - react-native build release APK failed 管理React-Native Android的体系结构版本 - Managing architecture release for react-native android 如何将调试器附加到 react-native Android 应用程序中发布版本的本机代码? - How do I attach a debugger to native code of a release build in a react-native Android app? React-native Android 发布版本已损坏(UI 导航中断且无错误)- 在调试版本中正常工作 - React-native Android release build broken (UI navigation breaks without error) - works correctly in debug build Android 应用程序在发布版本时崩溃,但在调试版本中有效 - React-Native - Android app crashes on release build but works in debug build - React-Native 在纱线工作区 monorepo 中使用 react-native (0.68.2) 的 Android 版本构建崩溃 - Android release build crashes using react-native (0.68.2) in yarn workspaces monorepo Android- react-native 应用程序在发布版本时崩溃,但在调试模式下运行 - Android- react-native app crashes on release build but runs on debug mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM