Skip to content

Commit eac4396

Browse files
committed
fix: fix build failure with react-native 0.73 rc
1 parent 8c0cbae commit eac4396

File tree

1 file changed

+18
-3
lines changed
  • packages/create-react-native-library/templates/native-common/android

1 file changed

+18
-3
lines changed

packages/create-react-native-library/templates/native-common/android/build.gradle

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,13 @@ android {
9898
defaultConfig {
9999
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
100100
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
101+
<% if (project.arch === "new" || project.arch === "mixed") { -%>
101102
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
102-
<% if (project.view && (project.arch === "new" || project.arch === "mixed")) { -%>
103+
<% if (project.view) { -%>
103104
buildConfigField "String", "CODEGEN_MODULE_REGISTRATION", (isNewArchitectureEnabled() && registrationCompat ? "\"${codegenViewModuleName}_registration\"" : "null")
104105
<% } -%>
106+
<% } -%>
107+
105108
<% if (project.cpp) { -%>
106109
externalNativeBuild {
107110
cmake {
@@ -131,12 +134,14 @@ android {
131134
<% } -%>
132135
}
133136
<% if (project.cpp) { -%>
137+
134138
externalNativeBuild {
135139
cmake {
136140
path "CMakeLists.txt"
137141
}
138142
}
139143
<% } else if (project.view && (project.arch === "new" || project.arch === "mixed")) { -%>
144+
140145
if (isNewArchitectureEnabled() && registrationCompat) {
141146
// We configure the NDK build only if you decide to opt-in for the New Architecture.
142147
externalNativeBuild {
@@ -146,6 +151,13 @@ android {
146151
}
147152
}
148153
<% } -%>
154+
<% if (project.arch === "new" || project.arch === "mixed") { -%>
155+
156+
buildFeatures {
157+
buildConfig true
158+
}
159+
<% } -%>
160+
149161
buildTypes {
150162
release {
151163
minifyEnabled false
@@ -160,8 +172,8 @@ android {
160172
sourceCompatibility JavaVersion.VERSION_1_8
161173
targetCompatibility JavaVersion.VERSION_1_8
162174
}
163-
164175
<% if (project.arch === "new") { -%>
176+
165177
sourceSets {
166178
main {
167179
if (isNewArchitectureEnabled()) {
@@ -173,6 +185,7 @@ android {
173185
}
174186
}
175187
<% } else if (project.arch === "mixed") { -%>
188+
176189
sourceSets {
177190
main {
178191
if (isNewArchitectureEnabled()) {
@@ -208,14 +221,16 @@ dependencies {
208221
<% } -%>
209222
}
210223

224+
<% if (project.arch === "new" || project.arch === "mixed") { -%>
211225
if (isNewArchitectureEnabled()) {
212226
react {
213227
jsRootDir = file("../src/")
214-
<% if (project.view && (project.arch === "new" || project.arch === "mixed")) { -%>
228+
<% if (project.view) { -%>
215229
libraryName = codegenViewLibraryName
216230
<% } else { -%>
217231
libraryName = "<%- project.view ? project.name + 'View' : project.name -%>"
218232
<% } -%>
219233
codegenJavaPackageName = "com.<%- project.package -%>"
220234
}
221235
}
236+
<% } -%>

0 commit comments

Comments
 (0)