Could not load exp:// Something went wrong

N Sharma picture N Sharma · Jun 20, 2017 · Viewed 39.3k times · Source

I have created a project using Expo XDE. I checked this Can't load expo app: Something went wrong but I have already enabled "Draw over other apps". It works https://expo.io/@ajaysaini/first-proj when I scan this QR code but it doesn't when I run it on android device from 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);

When I am running it on device it shows below error on android device. I tried restart in XDE multiple times but it didn't help me.

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

Error:

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

Can anyone help me what is going wrong ?

Answer

eden picture eden · Jun 30, 2017

You better open XDE Client and enable development mode. Then, click on the gray cog to make Host > LAN (Local area network - which means sharing packages over WiFi with a real device).

Localhost option may work as well but according to 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.

Also, here is a visual informative answer that I wrote a few months ago that may also help: How do I run an app on a real iOS device using Expo?