From 6f54846a08025c05ab7c7bf514f189085cde7b18 Mon Sep 17 00:00:00 2001 From: Alexander Martinz Date: Fri, 13 Feb 2026 09:55:21 -0800 Subject: [PATCH] Allow overriding dev server ip via property (#55531) Summary: Similiar to how a specific port can be set also allow for setting a specific ip for the dev server. This allows for easy configuration to aid in generating [reproducible builds](https://izzyondroid.org/docs/reproducibleBuilds/). ## Changelog: [ANDROID] [ADDED] - Allow specifying dev server ip via gradle property Pull Request resolved: https://github.com/facebook/react-native/pull/55531 Test Plan: 1) Add `reactNativeDevServerIp=localhost` to `gradle.properties` 2) Generate an APK 3) Analyze the APK and check that the value of the string resource type `react_native_dev_server_ip` matches the value set in `gradle.properties`. Reviewed By: cortinico Differential Revision: D93143296 Pulled By: CalixTang fbshipit-source-id: d0be23e9495f0ba1a6034dc31b6e725fd94a6a02 --- .../kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt index 2608e77f43f..c4a7b359d54 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt @@ -88,6 +88,7 @@ internal object AgpConfiguratorUtils { } fun configureDevServerLocation(project: Project) { + val devServerIp = project.properties["reactNativeDevServerIp"]?.toString() ?: getHostIpAddress() val devServerPort = project.properties["reactNativeDevServerPort"]?.toString() ?: DEFAULT_DEV_SERVER_PORT @@ -100,7 +101,7 @@ internal object AgpConfiguratorUtils { ext.defaultConfig.resValue( "string", "react_native_dev_server_ip", - getHostIpAddress(), + devServerIp, ) ext.defaultConfig.resValue("integer", "react_native_dev_server_port", devServerPort) }