1
+ apply plugin : " com.android.application"
2
+ apply plugin : " com.facebook.react"
3
+ apply plugin : " com.google.gms.google-services"
4
+ apply plugin : " com.google.firebase.crashlytics"
5
+
6
+ import com.android.build.OutputFile
7
+ import groovy.json.JsonSlurper
8
+
9
+ /* * React Native Vector Icons **/
10
+ project. ext. vectoricons = [
11
+ iconFontNames : [ ' MaterialCommunityIcons.ttf' ]
12
+ ]
13
+ apply from : " ../../node_modules/react-native-vector-icons/fonts.gradle"
14
+
15
+ /**
16
+ * This is the configuration block to customize your React Native Android app.
17
+ * By default you don't need to apply any configuration, just uncomment the lines you need.
18
+ */
19
+ react {
20
+ /* Folders */
21
+ // The root of your project, i.e. where "package.json" lives. Default is '..'
22
+ // root = file("../")
23
+ // The folder where the react-native NPM package is. Default is ../node_modules/react-native
24
+ // reactNativeDir = file("../node_modules/react-native")
25
+ // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
26
+ // codegenDir = file("../node_modules/react-native-codegen")
27
+ // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
28
+ // cliFile = file("../node_modules/react-native/cli.js")
29
+
30
+ /* Variants */
31
+ // The list of variants to that are debuggable. For those we're going to
32
+ // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
33
+ // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
34
+ // debuggableVariants = ["liteDebug", "prodDebug"]
35
+
36
+ /* Bundling */
37
+ // A list containing the node command and its flags. Default is just 'node'.
38
+ // nodeExecutableAndArgs = ["node"]
39
+ //
40
+ // The command to run when bundling. By default is 'bundle'
41
+ // bundleCommand = "ram-bundle"
42
+ //
43
+ // The path to the CLI configuration file. Default is empty.
44
+ // bundleConfig = file(../rn-cli.config.js)
45
+ //
46
+ // The name of the generated asset file containing your JS bundle
47
+ // bundleAssetName = "MyApplication.android.bundle"
48
+ //
49
+ // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
50
+ // entryFile = file("../js/MyApplication.android.js")
51
+ //
52
+ // A list of extra flags to pass to the 'bundle' commands.
53
+ // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
54
+ // extraPackagerArgs = []
55
+
56
+ /* Hermes Commands */
57
+ // The hermes compiler command to run. By default it is 'hermesc'
58
+ // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
59
+ //
60
+ // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
61
+ // hermesFlags = ["-O", "-output-source-map"]
62
+ }
63
+
64
+ /**
65
+ * Set this to true to create four separate APKs instead of one,
66
+ * one for each native architecture. This is useful if you don't
67
+ * use App Bundles (https://developer.android.com/guide/app-bundle/)
68
+ * and want to have separate APKs to upload to the Play Store.
69
+ */
70
+ def enableSeparateBuildPerCPUArchitecture = false
71
+
72
+ /**
73
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
74
+ */
75
+ def enableProguardInReleaseBuilds = false
76
+
77
+ /**
78
+ * The preferred build flavor of JavaScriptCore (JSC)
79
+ *
80
+ * For example, to use the international variant, you can use:
81
+ * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
82
+ *
83
+ * The international variant includes ICU i18n library and necessary data
84
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
85
+ * give correct results when using with locales other than en-US. Note that
86
+ * this variant is about 6MiB larger per architecture than default.
87
+ */
88
+ def jscFlavor = ' org.webkit:android-jsc:+'
89
+
90
+ /**
91
+ * Private function to get the list of Native Architectures you want to build.
92
+ * This reads the value from reactNativeArchitectures in your gradle.properties
93
+ * file and works together with the --active-arch-only flag of react-native run-android.
94
+ */
95
+ def reactNativeArchitectures () {
96
+ def value = project. getProperties(). get(" reactNativeArchitectures" )
97
+ return value ? value. split(" ," ) : [" armeabi-v7a" , " x86" , " x86_64" , " arm64-v8a" ]
98
+ }
99
+
100
+ /**
101
+ * Get version from package json
102
+ */
103
+ def getNpmVersion () {
104
+ def inputFile = new File (" ../package.json" )
105
+ def packageJson = new JsonSlurper (). parseText(inputFile. text)
106
+ return packageJson[" version" ]
107
+ }
108
+
109
+ def npmVersion = getNpmVersion()
110
+
111
+ android {
112
+ ndkVersion rootProject. ext. ndkVersion
113
+
114
+ compileSdkVersion rootProject. ext. compileSdkVersion
115
+
116
+ namespace = " dev.vasc.vshop2"
117
+ defaultConfig {
118
+ applicationId " dev.vasc.vshop2"
119
+ minSdkVersion rootProject. ext. minSdkVersion
120
+ targetSdkVersion rootProject. ext. targetSdkVersion
121
+ versionCode 52
122
+ versionName npmVersion
123
+ }
124
+
125
+ splits {
126
+ abi {
127
+ reset()
128
+ enable enableSeparateBuildPerCPUArchitecture
129
+ universalApk true // If true, also generate a universal APK
130
+ include (* reactNativeArchitectures())
131
+ }
132
+ }
133
+
134
+ def keystoreProperties = new Properties ()
135
+ def keystorePropertiesFile = rootProject. file(' key.properties' )
136
+ if (keystorePropertiesFile. exists()) {
137
+ keystoreProperties. load(new FileInputStream (keystorePropertiesFile))
138
+ }
139
+ signingConfigs {
140
+ debug {
141
+ storeFile file(" debug.keystore" )
142
+ storePassword " android"
143
+ keyAlias " androiddebugkey"
144
+ keyPassword " android"
145
+ }
146
+ release {
147
+ storeFile file(keystoreProperties[" storeFile" ])
148
+ storePassword keystoreProperties[" storePassword" ]
149
+ keyAlias keystoreProperties[" keyAlias" ]
150
+ keyPassword keystoreProperties[" keyPassword" ]
151
+ }
152
+ }
153
+ buildTypes {
154
+ debug {
155
+ signingConfig signingConfigs. debug
156
+ }
157
+ release {
158
+ signingConfig signingConfigs. release
159
+ minifyEnabled enableProguardInReleaseBuilds
160
+ proguardFiles getDefaultProguardFile(" proguard-android.txt" ), " proguard-rules.pro"
161
+ }
162
+ }
163
+
164
+ // applicationVariants are e.g. debug, release
165
+ applicationVariants. all { variant ->
166
+ variant. outputs. each { output ->
167
+ // For each separate APK per architecture, set a unique version code as described here:
168
+ // https://developer.android.com/studio/build/configure-apk-splits.html
169
+ // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
170
+ def versionCodes = [" armeabi-v7a" : 1 , " x86" : 2 , " arm64-v8a" : 3 , " x86_64" : 4 ]
171
+ def abi = output. getFilter(OutputFile . ABI )
172
+ if (abi != null ) { // null for the universal-debug, universal-release variants
173
+ output. versionCodeOverride =
174
+ defaultConfig. versionCode * 1000 + versionCodes. get(abi)
175
+ }
176
+
177
+ }
178
+ }
179
+ }
180
+
181
+ dependencies {
182
+ // The version of react-native is set by the React Native Gradle Plugin
183
+ implementation(" com.facebook.react:react-android" )
184
+
185
+ implementation(" androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" )
186
+
187
+ debugImplementation(" com.facebook.flipper:flipper:${ FLIPPER_VERSION} " )
188
+ debugImplementation(" com.facebook.flipper:flipper-network-plugin:${ FLIPPER_VERSION} " ) {
189
+ exclude group :' com.squareup.okhttp3' , module :' okhttp'
190
+ }
191
+
192
+ debugImplementation(" com.facebook.flipper:flipper-fresco-plugin:${ FLIPPER_VERSION} " )
193
+ if (hermesEnabled. toBoolean()) {
194
+ implementation(" com.facebook.react:hermes-android" )
195
+ } else {
196
+ implementation jscFlavor
197
+ }
198
+ }
199
+
200
+ apply from : file(" ../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle" ); applyNativeModulesAppBuildGradle(project)
0 commit comments