int MILLIS_IN_MINUTE = 1000 * 60 int minutesSinceEpoch = System.currentTimeMillis() / MILLIS_IN_MINUTE def safeExtGet(prop, fallback) { rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback } def isNewArchitectureEnabled() { return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true" } apply plugin: 'com.android.library' if (isNewArchitectureEnabled()) { apply plugin: 'com.facebook.react' } android { compileSdkVersion safeExtGet('compileSdkVersion', 28) buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3') defaultConfig { minSdkVersion safeExtGet('minSdkVersion', 16) targetSdkVersion safeExtGet('targetSdkVersion', 27) versionCode 1 versionName "1.0" consumerProguardFiles "proguard.pro" buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() } sourceSets { main { // let gradle pack the shared library into apk jniLibs.srcDirs = ['./lib'] if (isNewArchitectureEnabled()) { java.srcDirs += ['src/newarch'] } else { java.srcDirs += ['src/oldarch'] } } } buildTypes { release { resValue("string", "pushy_build_time", "${minutesSinceEpoch}") } debug { resValue("string", "pushy_build_time", "0") } } } repositories { maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } } dependencies { implementation 'com.facebook.react:react-native:+' implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.0' } if (isNewArchitectureEnabled()) { react { jsRootDir = file("../lib/") libraryName = "update" codegenJavaPackageName = "cn.reactnative.modules.update" } }