Expo应用程序不会在Android模拟器(错误)上运行。无法加载exp://127.0.0.1:19000
我正在使用 expo 在 Visual Studio代码中开发一个React Native应用。我正在 Android Studio Emulator 上渲染此应用程序,并且在A Windows OS 上开发。
直到最近,我从未在模拟器上呈现Expo应用程序遇到任何问题。 我的Android模拟器突然停止渲染任何Expo应用程序,即使是新初始化的一个(因此,问题不能是添加到我的源代码中的任何依赖关系/模块)。
模拟器丢弃的错误是:
Something went wrong.
Could not load exp://127.0.0.1:19000
Uncaught Error:java.lang.Exception:{"error":"Error:self signed certificate in certification chain"}
终端在VS代码和Metro Bundler开发人员工具页面中丢弃的错误是:
Error: self signed certificate in certificate chain
at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)
at TLSSocket.emit (node:events:390:28)
at TLSSocket._finishInit (node:_tls_wrap:944:8)
at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12)
我试图尝试在Metro Bundler开发人员工具页面上的 lan 和本地选项之间进行切换。这两个选项都会产生上面的错误代码。
我已经尝试设置node_tls_reject_unauthorized
环境变量'0'0'
(我知道,我知道,不安全!),模拟器错误仍然是同样,当终端错误更改为:
Error: Request failed with status code 403
at createError (C:\Users\KCTCodingIm12\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\core\createError.js:16:15)
at settle (C:\Users\KCTCodingIm12\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (C:\Users\KCTCodingIm12\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\adapters\http.js:260:11)
at IncomingMessage.emit (node:events:402:35)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
如果我尝试使用隧道在我的地铁捆绑器中,我会收到以下消息:
Successfully ran `adb reverse`. Localhost URLs should work on the connected Android device.
Using legacy dev server: false
Tunnel URL not found (it might not be ready yet), falling back to LAN URL.
Tunnel URL not found (it might not be ready yet), falling back to LAN URL.
Error starting tunnel Starting tunnels timed out
我还尝试手动设置 react_native_packager_hostname 通过使用$ enk:react_native_packager_hostname =“ 127.0.0.1”
我的packager-info.json中的端口号如下: expo the expo fariable> envion> $ env:react_native_packager_hostname =“ 127.0.0.1”
我的packager-info.json中的端口号如下:
{
"devToolsPort": 19002,
"expoServerPort": 19000,
"packagerPort": 19000,
"webpackServerPort": 19006
}
expo应用程序在Web浏览器中运行的Expo应用程序很好。
这是我直接在Android Studio上尝试的事情:
- 我尝试删除所有虚拟设备并重新创建它们。
- 我已经更新了所有SDK工具。
- 我已经从Android Studio上的设备管理器中擦除了数据。
- 我冷了,清除了模拟器的缓存。
整个星期,我一直很难射击这个问题,我尝试了比上面列出的问题更多的“解决方案” - 我很难过。
我无法想象这是一个网络/连接问题,因为我正在从同一设备运行代码编辑器和我的Android模拟器。另外,就像我说的那样,我的仿真器已经连接了几个月 - 我不知道突然的问题是什么。
I am developing a React Native app using Expo in Visual Studio Code. I am rendering this app on an Android Studio emulator and I am developing on a Windows OS.
I have never had any issues rendering the Expo app on the emulator until recently. My Android emulator has suddenly stopped rendering ANY expo application, even a newly initialized one (so the issue cannot be any dependencies/modules added to my source code).
The error that is thrown by the emulator is this:
Something went wrong.
Could not load exp://127.0.0.1:19000
Uncaught Error:java.lang.Exception:{"error":"Error:self signed certificate in certification chain"}
The error that is thrown by the terminal in VS Code and the Metro Bundler Developer Tools page is this:
Error: self signed certificate in certificate chain
at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)
at TLSSocket.emit (node:events:390:28)
at TLSSocket._finishInit (node:_tls_wrap:944:8)
at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12)
I have tried to switch between the LAN and LOCAL options on the Metro Bundler Developer Tools page. Both of these options produce the error code above.
I have tried setting the NODE_TLS_REJECT_UNAUTHORIZED
environment variable to '0'
( I know, I know, not secure!) and the emulator error remains the same, while the terminal error changes to:
Error: Request failed with status code 403
at createError (C:\Users\KCTCodingIm12\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\core\createError.js:16:15)
at settle (C:\Users\KCTCodingIm12\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (C:\Users\KCTCodingIm12\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\adapters\http.js:260:11)
at IncomingMessage.emit (node:events:402:35)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
If I attempt to use the Tunnel option in my Metro Bundler, I receive the following messages:
Successfully ran `adb reverse`. Localhost URLs should work on the connected Android device.
Using legacy dev server: false
Tunnel URL not found (it might not be ready yet), falling back to LAN URL.
Tunnel URL not found (it might not be ready yet), falling back to LAN URL.
Error starting tunnel Starting tunnels timed out
I have also tried to manually set the REACT_NATIVE_PACKAGER_HOSTNAME env variable by using $env:REACT_NATIVE_PACKAGER_HOSTNAME ="127.0.0.1"
The port numbers in my packager-info.json are as follows:
{
"devToolsPort": 19002,
"expoServerPort": 19000,
"packagerPort": 19000,
"webpackServerPort": 19006
}
The expo apps run in the web browser just fine.
Here are the things I have tried directly on Android studio:
- I have tried deleting all of my Virtual Devices and recreating them.
- I have updated all of my SDK Tools.
- I have wiped the data from the device manager on Android Studio.
- I have Cold Booted and cleared the cache of my emulator.
I have been trouble shooting this problem all week and I have tried many more "solutions" than the ones I listed above -- I am stumped.
I can't imagine this being a network/connection problem because I am running my code editor and my Android emulator from the same device. Also, like I said, my emulator has been connecting fine for months -- I have no idea what the sudden issue is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
博览会构建:Android已停产(2023年1月4日)
在终端步骤1中尝试此命令
: -
npm i -G eas-cli
步骤2: -
eas build:configure
step3: -
eas build build -p android- - Profile Preview
expo build: android has been discontinued (JAN 4 ,2023)
try this commands in terminal
step 1:-
npm i -g eas-cli
step 2:-
eas build:configure
step3:-
eas build -p android --profile preview
我仍然不确定发生了什么,但是我确实弄清楚了如何解决这个问题。
首先,我不得不将Android Studio设置为默认状态。我通过删除
androidStudio4.x
文件夹来做到这一点:然后我必须删除所有全球安装的节点模块。我通过删除以下内容的所有文件来做到这一点:
然后我从终端的内部删除了全局.expo文件。我通过导航到
c:\ users \ username>
并输入rmdir .expo
来做到这一点。重置并卸载所有这些内容后,我用
npm install -G expo -cli
重新安装了博览会,这是我的expo应用程序加载在我的Android模拟器上。再次 - 我不知道实际上是什么导致 这个错误,但是这些步骤确实解决了。
I still am not sure what was going on, but I did figure out how to solve this issue.
First, I had to reset my Android Studio setting back to their default state. I did this by deleting the
AndroidStudio4.X
folder found at:Then I had to delete all of my globally installed node modules. I did this by deleting all of the files inside of:
I then removed the global .expo file from inside of my terminal. I did this by navigating to
C:\Users\username>
and entering inrmdir .expo
.After I reset and uninstalled all of these things, I reinstalled Expo with
npm install -g expo-cli
, my Expo app loaded on my Android Emulator.Again - I have no idea what was actually causing this error, but these steps did solve it.
确保您将相同的无线网络(Internet)用于iOS或Android手机作为笔记本电脑/PC。
Make sure that you are using the same wireless network (Internet) for your iOS or Android phone as your Laptop/Pc.