@@ -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 *
@@ -73,7 +76,8 @@ import com.android.build.OutputFile
7376 */
7477
7578project. ext. react = [
76- entryFile : " index.js"
79+ entryFile : " index.js" ,
80+ enableHermes : false , // clean and rebuild if changing
7781]
7882
7983apply from : " ../../node_modules/react-native/react.gradle"
@@ -93,9 +97,31 @@ def enableSeparateBuildPerCPUArchitecture = false
9397 */
9498def enableProguardInReleaseBuilds = false
9599
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+
96122android {
97123 compileSdkVersion rootProject. ext. compileSdkVersion
98-
124+
99125 compileOptions {
100126 sourceCompatibility JavaVersion . VERSION_1_8
101127 targetCompatibility JavaVersion . VERSION_1_8
@@ -106,8 +132,9 @@ android {
106132 minSdkVersion rootProject. ext. minSdkVersion
107133 targetSdkVersion rootProject. ext. targetSdkVersion
108134 multiDexEnabled true
109- versionCode 20221
110- versionName " 2.3.7"
135+ versionCode 20222
136+ versionName " 3.0.0"
137+ missingDimensionStrategy ' react-native-camera' , ' general'
111138 }
112139 signingConfigs {
113140 release {
@@ -122,11 +149,14 @@ android {
122149 reset()
123150 enable enableSeparateBuildPerCPUArchitecture
124151 universalApk false // If true, also generate a universal APK
125- include " armeabi-v7a" , " x86" , " arm64-v8a" , " x86-64 "
152+ include " armeabi-v7a" , " x86" , " arm64-v8a" , " x86_64 "
126153 }
127154 }
128155 buildTypes {
129156 release {
157+ // Caution! In production, you need to generate your own keystore file.
158+ // see https://facebook.github.io/react-native/docs/signed-apk-android.
159+ signingConfig signingConfigs. debug
130160 minifyEnabled enableProguardInReleaseBuilds
131161 proguardFiles getDefaultProguardFile(" proguard-android.txt" ), " proguard-rules.pro"
132162 signingConfig signingConfigs. release
@@ -136,52 +166,48 @@ android {
136166 applicationVariants. all { variant ->
137167 variant. outputs. each { output ->
138168 // For each separate APK per architecture, set a unique version code as described here:
139- // http ://tools .android.com/tech-docs/new- build-system/user-guide/ apk-splits
140- def versionCodes = [" armeabi-v7a" :1 , " x86" :2 , " arm64-v8a" : 3 , " x86-64 " : 4 ]
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 ]
141171 def abi = output. getFilter(OutputFile . ABI )
142172 if (abi != null ) { // null for the universal-debug, universal-release variants
143173 output. versionCodeOverride =
144174 versionCodes. get(abi) * 1048576 + defaultConfig. versionCode
145175 }
146176 }
147177 }
148- }
149178
150- dependencies {
151- implementation project(' :@react-native-community_async-storage' )
152- compile project(' :react-native-rsa-native' )
153- compile project(' :react-native-camera' )
154- compile project(' :react-native-splash-screen' )
155- compile ' com.android.support:multidex:1.0.3'
156- compile(project(' :react-native-firebase' )) {
157- transitive = false
179+ packagingOptions {
180+ pickFirst ' **/armeabi-v7a/libc++_shared.so'
181+ pickFirst ' **/x86/libc++_shared.so'
182+ pickFirst ' **/arm64-v8a/libc++_shared.so'
183+ pickFirst ' **/x86_64/libc++_shared.so'
184+ pickFirst ' **/x86/libjsc.so'
185+ pickFirst ' **/armeabi-v7a/libjsc.so'
158186 }
187+ }
159188
160- // RNFirebase required dependencies
161- implementation " com.google.firebase:firebase-core:15.0.2"
162- implementation " com.google.android.gms:play-services-base:15.0.0"
163-
164- // RNFirebase optional dependencies
165- // implementation "com.google.firebase:firebase-ads:15.0.0"
166- // implementation "com.google.firebase:firebase-auth:15.1.0"
167- // implementation "com.google.firebase:firebase-config:15.0.0"
168- // implementation "com.google.firebase:firebase-database:15.0.0"
169- // implementation "com.google.firebase:firebase-invites:15.0.1"
170- implementation " com.google.firebase:firebase-firestore:16.0.0"
171- implementation " com.google.firebase:firebase-messaging:15.0.2"
172- // implementation "com.google.firebase:firebase-perf:15.1.0"
173- // implementation "com.google.firebase:firebase-storage:15.0.2"
174-
175- compile project(' :react-native-i18n' )
176- compile project(' :react-native-vector-icons' )
189+ dependencies {
177190 implementation fileTree(dir : " libs" , include : [" *.jar" ])
178- implementation " com.android.support:appcompat-v7:${ rootProject.ext.supportLibVersion} "
179191 implementation " com.facebook.react:react-native:+" // From node_modules
192+ implementation " com.google.android.gms:play-services-base:17.0.0"
193+ implementation " com.google.firebase:firebase-core:17.0.1"
194+ implementation " com.google.firebase:firebase-analytics:17.2.0"
195+ implementation " com.google.firebase:firebase-messaging:19.0.0"
196+ if (enableHermes) {
197+ def hermesPath = " ../../node_modules/hermesvm/android/" ;
198+ debugImplementation files(hermesPath + " hermes-debug.aar" )
199+ releaseImplementation files(hermesPath + " hermes-release.aar" )
200+ } else {
201+ implementation jscFlavor
202+ }
180203}
181204
182205// Run this once to be able to run the application with BUCK
183206// puts all compile dependencies into folder libs for BUCK to use
184207task copyDownloadableDepsToLibs (type : Copy ) {
185208 from configurations. compile
186209 into ' libs'
187- }
210+ }
211+
212+ apply from : file(" ../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle" ); applyNativeModulesAppBuildGradle(project)
213+ apply plugin : ' com.google.gms.google-services'
0 commit comments