简体   繁体   English

使用 Metro 响应本机调试版本构建

[英]React Native debug release build with Metro

I am working on a react-native application, when I run my debug build I am able to debug using the metro tool using the following commands.我正在开发一个 react-native 应用程序,当我运行我的调试版本时,我可以使用 Metro 工具使用以下命令进行调试。

npx react-native start 

npx react-native run-android

Magically my emulator pops up and if I click "d" in the metro terminal it activated my debugging tools.我的模拟器神奇地弹出,如果我在地铁终端中单击“d”,它会激活我的调试工具。

When I run当我跑

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

When I click "d" in the metro terminal it says当我在地铁站点击“d”时,它说

warn No apps connected. Sending "devMenu" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.

info Opening developer menu...信息正在打开开发者菜单...

Is there something about the release build that does not allow for the use of these debugging tools or is there something I need to do within build.gradle or some other configuation file to enable using the metro debugger.是否有一些关于发布版本的内容不允许使用这些调试工具,或者我需要在 build.gradle 或其他一些配置文件中做些什么来启用 Metro 调试器。

I am new to react-native development so my apologies if my terminology is off.我是 react-native 开发的新手,所以如果我的术语不合适,我深表歉意。

Appreciate you help!感谢您的帮助!

After receiving feedback from various people on and off of SO it seems that the debugger is not meant to be used in the release build.在收到来自 SO 内外各种人的反馈后,似乎调试器并不打算在发布版本中使用。

In my circumstance there was an issue with gradle configuration involving react-native-config which was a known issue related to Progaurd which would only impact release builds.在我的情况下,涉及 react-native-config 的 gradle 配置存在问题,这是与 Progaurd 相关的已知问题,只会影响发布版本。

As recommended in this post I used the javascript alert() method to debug the issue.正如这篇文章中所推荐的,我使用了 javascript alert() 方法来调试问题。

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

相关问题 React Native Android版本APK是调试版本,而不是版本 - React Native Android release apk is debug, not release 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 React Native 构建在构建调试/发布以外的新构建类型时失败 - React Native build fails on building a new build type other than debug/release React Native-构建版本失败 - React Native - Build Release Failed React Native Release App.apk 搜索 Metro 服务器 - React Native Release App.apk search metro server React Native 应用程序不会尝试在调试模式下连接到 Metro Bundler - React Native app does not attempt to connect to Metro Bundler in debug mode Android- react-native 应用程序在发布版本时崩溃,但在调试模式下运行 - Android- react-native app crashes on release build but runs on debug mode React Native 应用程序(发布版本)在启动时崩溃,在调试中工作正常。 为什么? - React Native app (release build) crashes on start, works fine in debug. Why? 调试和发布 apk 在 React Native 0.63.3 中不起作用 - Debug and Release apk not working in React Native 0.63.3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM