Skip to content

Commit 9dfcfa0

Browse files
committed
Add support for new architecture in build.gradle
1 parent de5d1d0 commit 9dfcfa0

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

android/app/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
apply plugin: "com.android.library"
22

3+
def isNewArchitectureEnabled() {
4+
// To opt-in for the New Architecture, you can either:
5+
// - Set `newArchEnabled` to true inside the `gradle.properties` file
6+
// - Invoke gradle with `-newArchEnabled=true`
7+
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
8+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
9+
}
10+
11+
def IS_NEW_ARCHITECTURE_ENABLED = isNewArchitectureEnabled()
12+
13+
if (IS_NEW_ARCHITECTURE_ENABLED) {
14+
apply plugin: "com.facebook.react"
15+
}
16+
317
def DEFAULT_COMPILE_SDK_VERSION = 26
418
def DEFAULT_BUILD_TOOLS_VERSION = "26.0.3"
519
def DEFAULT_TARGET_SDK_VERSION = 26
@@ -16,6 +30,7 @@ android {
1630
targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
1731
versionCode 1
1832
versionName "1.0"
33+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", IS_NEW_ARCHITECTURE_ENABLED.toString()
1934
}
2035

2136
lintOptions {

0 commit comments

Comments
 (0)