英文:
See Network Tab In React Native Expo
问题
我刚刚在Expo中开始了一个新的应用程序,因为我的RN CLI应用程序在Xcode更新后被清除了(对发生了什么事情还心有余悸/困惑)。
在CLI中,我可以毫无问题地使用[React Native Debugger][1]工具。但在Expo中,我无法使其正常工作。
我遵循了[问题][2]中的说明
```json
// 添加到app.json
"jsEngine": "hermes",
"ios": {
"jsEngine": "jsc",
"supportsTablet": true
}
这没有起作用。我尝试去掉ios
对象,使我的jsEngine
为hermes
,但这也没有起作用。
步骤:
- 使用
npx expo start --localhost
启动一个新的Expo项目 - 在
app.json
中设置"jsEngine": "hermes"
- 等待应用程序启动
- 运行
open "rndebugger://set-debugger-loc?host=localhost&port=19000"
我可以打开调试器UI,但它无法连接到我的应用程序。
我的应用程序正在运行Expo 48.x.x。我唯一的选择是降级到Expo <47
吗?不能看到我的网络请求是无法忍受的,也很惊讶RN中这还不是一个开箱即用的功能。
<details>
<summary>英文:</summary>
I just started a new app in Expo after my RN CLI app was wiped out from a Xcode update (still scarred/confused on what exactly happened).
In CLI I was able to use the [React Native Debugger][1] tool without issue. On Expo, I have not been able to get it working.
I followed the directions in [issue][2]
// Add to app.json
"jsEngine": "hermes",
"ios": {
"jsEngine": "jsc",
"supportsTablet": true
}
This did not work. I tried getting rid of the `ios` object so that my `jsEngine` is `hermes` but this also didn't work.
Steps:
1. Start a new Expo project using `npx expo start --localhost`
2. Set `"jsEngine": "hermes"` in `app.json`
3. Wait for app to turn on
4. Run `open "rndebugger://set-debugger-loc?host=localhost&port=19000"`
I get the debugger UI open, but it does not connect to my app.
My app is running Expo 48.x.x. Is my only option to downgrade to Expo <47? Not being able to see my network requests is unbearable and very surprised that this is not an out of the box feature in RN yet.
[1]: https://github.com/jhen0409/react-native-debugger
[2]: https://github.com/jhen0409/react-native-debugger/issues/754#issuecomment-1469852938
</details>
# 答案1
**得分**: 1
Expo SDK 49现在内置了网络调试功能,但不幸的是,目前在Android上无法正确工作。更多信息如下。
要在修复后收到通知,请订阅[此问题](https://github.com/facebook/react-native/issues/38006#issuecomment-1612231371)
> 重要提示:由于React Native 0.72中Hermes调试器在Android上存在回归(请参考GitHub了解背景情况),如果这是您工作流程的重要部分,我们建议等待升级到SDK 49。此外,为确保新项目默认具有正常的调试体验,create-expo-app创建的默认项目将继续设置为SDK 48,直到此问题得到解决。
>
> 要使用SDK 49创建新项目:`npx create-expo-app@latest --template blank@sdk-49` 将“blank”替换为“tabs”以使用expo-router模板。
通过[Expo SDK 49](https://blog.expo.dev/expo-sdk-49-c6d398cdf740)获取。
<details>
<summary>英文:</summary>
Expo SDK 49 now has built-in Network debugging, but unfortunately it does not work correctly on Android at this time. More info below.
To get notified when it's fixed, subscribe to [this issue](https://github.com/facebook/react-native/issues/38006#issuecomment-1612231371)
> Important: Due to a regression in the Hermes debugger for Android in React Native 0.72 (see GitHub for context), we recommend waiting before upgrading to SDK 49 if this is an important part of your workflow. Additionally, in order to ensure that new projects default to a working debugging experience, the default project created by create-expo-app will continue to be set to SDK 48 until this issue is resolved.
>
> To create a new project with SDK 49: `npx create-expo-app@latest --template blank@sdk-49` Replace “blank” with “tabs” for the expo-router template.
via [Expo SDK 49](https://blog.expo.dev/expo-sdk-49-c6d398cdf740)
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论