@@ -18,6 +18,9 @@ import com.android.build.OutputFile
1818 * // the entry file for bundle generation
1919 * entryFile: "index.android.js",
2020 *
21+ * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
22+ * bundleCommand: "ram-bundle",
23+ *
2124 * // whether to bundle JS and assets in debug mode
2225 * bundleInDebug: false,
2326 *
@@ -33,6 +36,13 @@ import com.android.build.OutputFile
3336 * // bundleInPaidRelease: true,
3437 * // bundleInBeta: true,
3538 *
39+ * // whether to disable dev mode in custom build variants (by default only disabled in release)
40+ * // for example: to disable dev mode in the staging build type (if configured)
41+ * devDisabledInStaging: true,
42+ * // The configuration property can be in the following formats
43+ * // 'devDisabledIn${productFlavor}${buildType}'
44+ * // 'devDisabledIn${buildType}'
45+ *
3646 * // the root of your project, i.e. where "package.json" lives
3747 * root: "../../",
3848 *
@@ -58,13 +68,18 @@ import com.android.build.OutputFile
5868 * inputExcludes: ["android/**", "ios/**"],
5969 *
6070 * // override which node gets called and with what additional arguments
61- * nodeExecutableAndArgs: ["node"]
71+ * nodeExecutableAndArgs: ["node"],
6272 *
6373 * // supply additional arguments to the packager
6474 * extraPackagerArgs: []
6575 * ]
6676 */
6777
78+ project.ext.react = [
79+ entryFile: "index.js",
80+ enableHermes: false, // clean and rebuild if changing
81+ ]
82+
6883apply from: "../../node_modules/react-native/react.gradle"
6984
7085/**
@@ -82,30 +97,67 @@ def enableSeparateBuildPerCPUArchitecture = false
8297 */
8398def enableProguardInReleaseBuilds = false
8499
100+ /**
101+ * The preferred build flavor of JavaScriptCore.
102+ *
103+ * For example, to use the international variant, you can use:
104+ * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105+ *
106+ * The international variant includes ICU i18n library and necessary data
107+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
108+ * give correct results when using with locales other than en-US. Note that
109+ * this variant is about 6MiB larger per architecture than default.
110+ */
111+ def jscFlavor = 'org.webkit:android-jsc:+'
112+
113+ /**
114+ * Whether to enable the Hermes VM.
115+ *
116+ * This should be set on project.ext.react and mirrored here. If it is not set
117+ * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
118+ * and the benefits of using Hermes will therefore be sharply reduced.
119+ */
120+ def enableHermes = project.ext.react.get("enableHermes", false);
121+
85122android {
86123 compileSdkVersion rootProject.ext.compileSdkVersion
87- buildToolsVersion rootProject.ext.buildToolsVersion
124+
125+ compileOptions {
126+ sourceCompatibility JavaVersion.VERSION_1_8
127+ targetCompatibility JavaVersion.VERSION_1_8
128+ }
88129
89130 defaultConfig {
90- applicationId "com.example "
131+ applicationId "com.autogrowtextinput "
91132 minSdkVersion rootProject.ext.minSdkVersion
92133 targetSdkVersion rootProject.ext.targetSdkVersion
93134 versionCode 1
94135 versionName "1.0"
95- ndk {
96- abiFilters "armeabi-v7a", "x86"
97- }
98136 }
99137 splits {
100138 abi {
101139 reset()
102140 enable enableSeparateBuildPerCPUArchitecture
103141 universalApk false // If true, also generate a universal APK
104- include "armeabi-v7a", "x86"
142+ include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
143+ }
144+ }
145+ signingConfigs {
146+ debug {
147+ storeFile file('debug.keystore')
148+ storePassword 'android'
149+ keyAlias 'androiddebugkey'
150+ keyPassword 'android'
105151 }
106152 }
107153 buildTypes {
154+ debug {
155+ signingConfig signingConfigs.debug
156+ }
108157 release {
158+ // Caution! In production, you need to generate your own keystore file.
159+ // see https://facebook.github.io/react-native/docs/signed-apk-android.
160+ signingConfig signingConfigs.debug
109161 minifyEnabled enableProguardInReleaseBuilds
110162 proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
111163 }
@@ -114,22 +166,29 @@ android {
114166 applicationVariants.all { variant ->
115167 variant.outputs.each { output ->
116168 // For each separate APK per architecture, set a unique version code as described here:
117- // http ://tools .android.com/tech-docs/new- build-system/user-guide/ apk-splits
118- def versionCodes = ["armeabi-v7a":1, "x86":2 ]
169+ // https ://developer .android.com/studio/ build/configure- apk-splits.html
170+ def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4 ]
119171 def abi = output.getFilter(OutputFile.ABI)
120172 if (abi != null) { // null for the universal-debug, universal-release variants
121173 output.versionCodeOverride =
122174 versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
123175 }
176+
124177 }
125178 }
126179}
127180
128181dependencies {
129182 implementation fileTree(dir: "libs", include: ["*.jar"])
130- implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
131183 implementation "com.facebook.react:react-native:+" // From node_modules
132- implementation project(':react-native-autogrow-textinput')
184+
185+ if (enableHermes) {
186+ def hermesPath = "../../node_modules/hermes-engine/android/";
187+ debugImplementation files(hermesPath + "hermes-debug.aar")
188+ releaseImplementation files(hermesPath + "hermes-release.aar")
189+ } else {
190+ implementation jscFlavor
191+ }
133192}
134193
135194// Run this once to be able to run the application with BUCK
@@ -138,3 +197,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
138197 from configurations.compile
139198 into 'libs'
140199}
200+
201+ apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
0 commit comments