diff --git a/packages/expo-dev-launcher/CHANGELOG.md b/packages/expo-dev-launcher/CHANGELOG.md index 487f19d770ade..e1721ba356ed7 100644 --- a/packages/expo-dev-launcher/CHANGELOG.md +++ b/packages/expo-dev-launcher/CHANGELOG.md @@ -12,6 +12,7 @@ - Remove the deprecated `Linking.removeEventListener` in expo-dev-launcher bundle. ([#18939](https://github.com/expo/expo/pull/18939) by [@kudo](https://github.com/kudo)) - Fixed the incompatibility with react-native-v8 on Android. ([#19117](https://github.com/expo/expo/pull/19117) by [@kudo](https://github.com/kudo)) +- Fixed crash when loading bundle without explicit port on Android. ([#19136](https://github.com/expo/expo/pull/19136) by [@kudo](https://github.com/kudo)) ### 💡 Others diff --git a/packages/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/helpers/DevLauncherReactUtils.kt b/packages/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/helpers/DevLauncherReactUtils.kt index c4b61415833cc..2a36d889fb32f 100644 --- a/packages/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/helpers/DevLauncherReactUtils.kt +++ b/packages/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/helpers/DevLauncherReactUtils.kt @@ -9,13 +9,15 @@ import com.facebook.react.bridge.JSBundleLoader import expo.interfaces.devmenu.annotations.ContainsDevMenuExtension import expo.modules.devlauncher.react.DevLauncherDevSupportManagerSwapper import expo.modules.devlauncher.react.DevLauncherInternalSettings +import okhttp3.HttpUrl fun injectReactInterceptor( context: Context, reactNativeHost: ReactNativeHost, url: Uri ): Boolean { - val debugServerHost = url.host + ":" + url.port + val port = if (url.port != -1) url.port else HttpUrl.defaultPort(url.scheme) + val debugServerHost = url.host + ":" + port // We need to remove "/" which is added to begin of the path by the Uri // and the bundle type val appBundleName = if (url.path.isNullOrEmpty()) {