简体   繁体   English

React Native App 仅通过浏览器运行

[英]React Native App runs only through the browser

When I start my app through expo start in the terminal, the QR code doesn't generate.当我通过expo start在终端中启动我的应用程序时,不会生成二维码。 And when I launch it through the Expo app on my phone当我通过手机上的 Expo 应用程序启动它时

the result is that the project is online but it has a different thumbnail and launches through the browser:结果是该项目在线,但它具有不同的缩略图并通过浏览器启动:

项目上线

If I try and change the url of it from http://192.168.1.94:19006 to exp://192.168.1.94:19006 like the rest of my apps, it shows If I try and change the url of it from http://192.168.1.94:19006 to exp://192.168.1.94:19006 like the rest of my apps, it shows

错误 1

and after clicking the view error log at the bottom, it returns点击底部的查看错误日志后,返回

错误 2 :

Uncaught Error: java.io.IOException: Manifest string is not a valid JSONObject or JSONArray: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta httpEquiv="X-UA-Compatible" content="IE=edge" /> This viewport works for phones with notches. It's optimized for gesture 

How do I make it run normally on my phone through the expo app instead of through the browser?如何通过 expo 应用程序而不是通过浏览器使其在手机上正常运行?

This is, in my experience, an issue not relating to your code, but the settings on your phone or the network itself.根据我的经验,这与您的代码无关,而是与您的手机或网络本身的设置有关。

Here's a few steps I recommend:以下是我推荐的几个步骤:

  1. Make sure wireless debugging is turned on.确保无线调试已打开。 My OnePlus phone often turns off wireless debugging when I switch networks.我的一加手机经常在切换网络时关闭无线调试。
  2. Switch to tunnel, there are often funny issues on Public Networks.切换到隧道,公共网络上经常有有趣的问题。
  3. Go to settings on your phone and find expo's settings. Go 到手机上的设置并找到 expo 的设置。 Turn the setting "Display over other apps", to off then on again (it should definitely be on).将“显示在其他应用程序上”设置关闭然后再次打开(它肯定应该打开)。
  4. Uninstall Expo Dev clients AND builds, this is often the cause for me.卸载 Expo 开发客户端和构建,这通常是我的原因。
  5. Try a wired connection (make sure USB debugging is on).尝试有线连接(确保 USB 调试已打开)。
  6. Reinstall Expo Go on your phone在手机上重新安装 Expo Go

This can be a real pain, good luck to all.这可能是一个真正的痛苦,祝大家好运。

Restarting the terminal where you're running Expo is what worked on my end:)重新启动您正在运行 Expo 的终端对我来说是有效的:)

Check you app.json, list your OS's in platforms检查您的 app.json,在平台中列出您的操作系统

"expo": {
  "name": "",
  "platforms": [
    "ios",
    "android",
    "web"
  ],
  ...
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM