android – 无法加载exp://出错了

我使用Expo XDE创建了一个项目.我检查了这个 Can’t load expo app: Something went wrong,但我已经启用了“绘制其他应用程序”.当我扫描这个二维码时,它工作 https://expo.io/@ajaysaini/first-proj但是当我在Android设备上从XDE运行它时它没有.

main.js

import Expo from 'expo';
import React from 'react';
import { StyleSheet,Text,View } from 'react-native';

class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>Updating!</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,backgroundColor: '#fff',alignItems: 'center',justifyContent: 'center',},});

Expo.registerRootComponent(App);

当我在设备上运行它时,它在Android设备上显示以下错误.我尝试多次在XDE中重启,但它没有帮助我.

Dependency graph loaded.
11:19:21 AM
Starting React Native packager...
11:19:24 AM
Scanning 528 folders for symlinks in D:\Expo\first-proj\first-proj\node_modules (18ms)
11:19:24 AM
Loading dependency graph.
11:19:24 AM
Running packager on port 19001.
11:19:25 AM
11:19:33 AM
Project opened! You can Now use the "Share" or "Device" buttons to view your project.
11:19:44 AM
opening on Android device
11:19:54 AM
Dependency graph loaded.
11:21:41 AM
opening on Android device
11:23:31 AM
opening on Android device

错误

There was an unhandled error: Could not load exp://
Stack Trace:

任何人都可以帮我解决问题吗?

解决方法

您最好打开XDE Client并启用开发模式.然后,单击灰色齿轮以使主机> LAN(局域网 – 这意味着通过WiFi与真实设备共享包).

Localhost选项可能也可以,但根据Expo Debugging docs

If you are using LAN,make sure your device is on the same wifi network as your development machine. This may not work on some public networks. localhost will not work for iOS unless you are in the simulator,and it only works on Android if your device is connected to your machine via USB.

此外,这是我几个月前写的一个视觉信息性答案,也可能有所帮助:How do I run an app on a real iOS device using Expo?

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...