Android doesn't load from metro in local mode

Hey all,

Struggling since a few days on this one. I managed to install expo-updates (everything works now :grinning:) but now the Android app doesn’t load from the Metro server anymore, neither in the simulator nor on the physical device over USB. I tried quite a few things already:

  • react-native start. Metro server is running, works fine on iOS and I can load the bundle using curl
  • tried adb reverse tcp:8081 tcp:8081, doesn’t change anything
  • tried changing the bundle location to the phone to my WIFI-IP (192.168…) still no change, again curl works here

Any hints on what I could try next?

AndroidManifest.xml (expo-udpates config):

      <meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/[appname]" />
      <meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="37.0.0" />

MainApplication.java

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }

    @Override
    protected @Nullable String getJSBundleFile() {
      if (BuildConfig.DEBUG) {
        return super.getJSBundleFile();
      } else {
        return UpdatesController.getInstance().getLaunchAssetFile();
      }
    }

    @Override
    protected @Nullable String getBundleAssetName() {
      if (BuildConfig.DEBUG) {
        return super.getBundleAssetName();
      } else {
        return UpdatesController.getInstance().getBundleAssetName();
      }
    }

Error Message on phone:
Could not connect to the development server.

After further googling I found a working solution. I must have bumped the SDK to 28 during the expo-update install and therefor it disabled unsecure http traffic to the metro server. This solution https://stackoverflow.com/a/55332862 resolved the problem.