@@ -9,7 +9,6 @@ package com.facebook.react.utils
99
1010import com.android.build.api.variant.ApplicationAndroidComponentsExtension
1111import com.android.build.api.variant.LibraryAndroidComponentsExtension
12- import com.android.build.gradle.LibraryExtension
1312import com.facebook.react.ReactExtension
1413import com.facebook.react.utils.ProjectUtils.isEdgeToEdgeEnabled
1514import com.facebook.react.utils.ProjectUtils.isHermesEnabled
@@ -59,18 +58,20 @@ internal object AgpConfiguratorUtils {
5958 project.extensions
6059 .getByType(ApplicationAndroidComponentsExtension ::class .java)
6160 .finalizeDsl { ext ->
62- ext.buildFeatures.buildConfig = true
63- ext.defaultConfig.buildConfigField(" boolean" , " IS_NEW_ARCHITECTURE_ENABLED" , " true" )
64- ext.defaultConfig.buildConfigField(
65- " boolean" ,
66- " IS_HERMES_ENABLED" ,
67- project.isHermesEnabled.toString(),
68- )
69- ext.defaultConfig.buildConfigField(
70- " boolean" ,
71- " IS_EDGE_TO_EDGE_ENABLED" ,
72- project.isEdgeToEdgeEnabled.toString(),
73- )
61+ ext.buildFeatures { buildConfig = true }
62+ ext.defaultConfig {
63+ buildConfigField(" boolean" , " IS_NEW_ARCHITECTURE_ENABLED" , " true" )
64+ buildConfigField(
65+ " boolean" ,
66+ " IS_HERMES_ENABLED" ,
67+ project.isHermesEnabled.toString(),
68+ )
69+ buildConfigField(
70+ " boolean" ,
71+ " IS_EDGE_TO_EDGE_ENABLED" ,
72+ project.isEdgeToEdgeEnabled.toString(),
73+ )
74+ }
7475 }
7576 }
7677 project.pluginManager.withPlugin(" com.android.application" , action)
@@ -82,7 +83,7 @@ internal object AgpConfiguratorUtils {
8283 subproject.pluginManager.withPlugin(" com.android.library" ) {
8384 subproject.extensions
8485 .getByType(LibraryAndroidComponentsExtension ::class .java)
85- .finalizeDsl { ext -> ext.buildFeatures. buildConfig = true }
86+ .finalizeDsl { ext -> ext.buildFeatures { buildConfig = true } }
8687 }
8788 }
8889 }
@@ -97,13 +98,15 @@ internal object AgpConfiguratorUtils {
9798 project.extensions
9899 .getByType(ApplicationAndroidComponentsExtension ::class .java)
99100 .finalizeDsl { ext ->
100- ext.buildFeatures.resValues = true
101- ext.defaultConfig.resValue(
102- " string" ,
103- " react_native_dev_server_ip" ,
104- devServerIp,
105- )
106- ext.defaultConfig.resValue(" integer" , " react_native_dev_server_port" , devServerPort)
101+ ext.buildFeatures { resValues = true }
102+ ext.defaultConfig {
103+ resValue(
104+ " string" ,
105+ " react_native_dev_server_ip" ,
106+ devServerIp,
107+ )
108+ resValue(" integer" , " react_native_dev_server_port" , devServerPort)
109+ }
107110 }
108111 }
109112
@@ -118,8 +121,8 @@ internal object AgpConfiguratorUtils {
118121 .getByType(LibraryAndroidComponentsExtension ::class .java)
119122 .finalizeDsl { ext ->
120123 if (ext.namespace == null ) {
121- val android = subproject.extensions.getByType( LibraryExtension :: class .java)
122- val manifestFile = android.sourceSets.getByName( " main" ).manifest.srcFile
124+ val manifestFile =
125+ subproject.file( " src/ main/AndroidManifest.xml " )
123126
124127 manifestFile
125128 .takeIf { it.exists() }
0 commit comments