android - 无法加载 exp ://Something went wrong

标签 android react-native expo

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

主要.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 中重新启动,但没有帮助。

enter image description here

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 客户端并启用开发模式。然后,点击gray cog 以创建Host > 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 - 无法加载 exp ://Something went wrong,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44644952/

相关文章:

Android 如何在 IntentService 上排队多个 Intent

android - 使用 AES 的对称加密导致 cipher.init 上的 NullPointerException

android - 将分隔线放置在 ListView 中的某个位置

java - 使用 java 更新 apk 内的文件

react-native - 安装 React-Native-firebase 后无法运行项目

javascript - 了解 React Native 中 <FlatList/> 中 renderItem 属性的解构

reactjs - fontFamily "$text-font-family"不是系统字体,没有通过 Font.loadAsync 加载

ios - 警告 : Failed child context type: Invalid child context 'virtualizedCell.cellKey' of type 'number' supplied to 'CellRenderer' , 预期 'string'

javascript - 如何将按钮文本颜色动态更改为 LinearGradient ScrollView 的背景颜色?

react-native - 安装 'expo start' 后无法运行 "@react-navigation/web"命令