Unable to connect Android phone to my project with Expo

感情迁移 提交于 2020-03-18 05:48:08

问题


I created my project in react native by CLI:

_npm install -g create-react-native-app
_create-react-native-app AwesomeProject
_cd AwesomeProject
_npm start

Then I installed expo in my Android phone, and scanned a QR code on my computer screen.

However, my phone can't connect to project, and I don't know why. It just loads and fails. This is error message:

Could not load exp:// 192.168.56.1:19000. Network response timed out.

This is view error:

"Uncaught Error: java,not.SocketTimeoutException: faild to connect to/192.168.56.1 (port 19000) after 10000 ms.

I'm trying to fix it, but still can't get it working. My phone and my laptop are on the same network. What can I do now?


回答1:


Keep a look on this issue for the answer: https://github.com/react-community/create-react-native-app/issues/60




回答2:


I had the same issue, turns out my firewall was blocking my connection to the development server port (for me it was 19000). Solved it by disabling firewall.




回答3:


Make sure that your device and computer are one same LAN/Wifi. It will work. Also use LAN option.




回答4:


I've had a similar problem on iOS - the project showed up in the Expo app but didn't want to connect.

Here's what I did:

  1. Connect your PC to your device through USB cable

  2. Download the newest xde from: https://github.com/expo/xde/releases

  3. Install XDE, create a new project from the gui (do NOT use your old project from create-react-app, as it may also show up in XDE) and click the newly created (in XDE) project under "My Projects".

Now your project should show up in the Expo app on your phone. If it doesn't try sending yourself the link to your app over email (to your own inbox, and open the link on your phone), mine looks like this: exp://5c-gp9.[accountname].my-new-project.exp.direct:80




回答5:


I had this problem when my phone was connected via wifi and my destop was connected via LAN. I changed the connection mode in the browser window to tunnel, reloaded the expo app and was able to connect to my application. This was on my iOS device.




回答6:


I got this issue on Win 10 with android and solved by the adding a firewall rule for my device (device IP as remote). I was using ESET NOD antivirus and it was block the device from accessing node.exe



来源:https://stackoverflow.com/questions/45558678/unable-to-connect-android-phone-to-my-project-with-expo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!