1
1
apply plugin : " com.android.application"
2
2
3
3
import com.android.build.OutputFile
4
+ import org.apache.tools.ant.taskdefs.condition.Os
4
5
5
6
/**
6
7
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
@@ -15,7 +16,9 @@ import com.android.build.OutputFile
15
16
* // the name of the generated asset file containing your JS bundle
16
17
* bundleAssetName: "index.android.bundle",
17
18
*
18
- * // the entry file for bundle generation
19
+ * // the entry file for bundle generation. If none specified and
20
+ * // "index.android.js" exists, it will be used. Otherwise "index.js" is
21
+ * // default. Can be overridden with ENTRY_FILE environment variable.
19
22
* entryFile: "index.android.js",
20
23
*
21
24
* // https://reactnative.dev/docs/performance#enable-the-ram-format
@@ -37,7 +40,7 @@ import com.android.build.OutputFile
37
40
* // bundleInBeta: true,
38
41
*
39
42
* // whether to disable dev mode in custom build variants (by default only disabled in release)
40
- * // for AndroidSystemBarsExample : to disable dev mode in the staging build type (if configured)
43
+ * // for example : to disable dev mode in the staging build type (if configured)
41
44
* devDisabledInStaging: true,
42
45
* // The configuration property can be in the following formats
43
46
* // 'devDisabledIn${productFlavor}${buildType}'
@@ -64,7 +67,7 @@ import com.android.build.OutputFile
64
67
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
65
68
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
66
69
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
67
- * // for AndroidSystemBarsExample , you might want to remove it from here.
70
+ * // for example , you might want to remove it from here.
68
71
* inputExcludes: ["android/**", "ios/**"],
69
72
*
70
73
* // override which node gets called and with what additional arguments
@@ -77,7 +80,6 @@ import com.android.build.OutputFile
77
80
78
81
project. ext. react = [
79
82
enableHermes : true , // clean and rebuild if changing
80
- entryFile : " index.tsx" ,
81
83
]
82
84
83
85
apply from : " ../../node_modules/react-native/react.gradle"
@@ -100,7 +102,7 @@ def enableProguardInReleaseBuilds = false
100
102
/**
101
103
* The preferred build flavor of JavaScriptCore.
102
104
*
103
- * For AndroidSystemBarsExample , to use the international variant, you can use:
105
+ * For example , to use the international variant, you can use:
104
106
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105
107
*
106
108
* The international variant includes ICU i18n library and necessary data
@@ -129,16 +131,17 @@ def reactNativeArchitectures() {
129
131
130
132
android {
131
133
ndkVersion rootProject. ext. ndkVersion
134
+
132
135
compileSdkVersion rootProject. ext. compileSdkVersion
133
136
134
137
defaultConfig {
135
- applicationId " com.example.hudlrnsystembars "
138
+ applicationId " com.example"
136
139
minSdkVersion rootProject. ext. minSdkVersion
137
140
targetSdkVersion rootProject. ext. targetSdkVersion
138
141
versionCode 1
139
142
versionName " 1.0"
140
143
buildConfigField " boolean" , " IS_NEW_ARCHITECTURE_ENABLED" , isNewArchitectureEnabled(). toString()
141
-
144
+
142
145
if (isNewArchitectureEnabled()) {
143
146
// We configure the NDK build only if you decide to opt-in for the New Architecture.
144
147
externalNativeBuild {
@@ -155,7 +158,11 @@ android {
155
158
cppFlags " -std=c++17"
156
159
// Make sure this target name is the same you specify inside the
157
160
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
158
- targets " hudlrnsystembars_appmodules"
161
+ targets " example_appmodules"
162
+ // Fix for windows limit on number of character in file paths and in command lines
163
+ if (Os . isFamily(Os . FAMILY_WINDOWS )) {
164
+ arguments " NDK_APP_SHORT_COMMANDS=true"
165
+ }
159
166
}
160
167
}
161
168
if (! enableSeparateBuildPerCPUArchitecture) {
@@ -165,7 +172,7 @@ android {
165
172
}
166
173
}
167
174
}
168
-
175
+
169
176
if (isNewArchitectureEnabled()) {
170
177
// We configure the NDK build only if you decide to opt-in for the New Architecture.
171
178
externalNativeBuild {
@@ -190,6 +197,7 @@ android {
190
197
// preBuild.dependsOn("generateCodegenArtifactsFromSchema")
191
198
preDebugBuild. dependsOn(packageReactNdkDebugLibs)
192
199
preReleaseBuild. dependsOn(packageReactNdkReleaseLibs)
200
+
193
201
// Due to a bug inside AGP, we have to explicitly set a dependency
194
202
// between configureNdkBuild* tasks and the preBuild tasks.
195
203
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
@@ -234,6 +242,7 @@ android {
234
242
proguardFiles getDefaultProguardFile(" proguard-android.txt" ), " proguard-rules.pro"
235
243
}
236
244
}
245
+
237
246
// applicationVariants are e.g. debug, release
238
247
applicationVariants. all { variant ->
239
248
variant. outputs. each { output ->
@@ -257,15 +266,17 @@ dependencies {
257
266
// noinspection GradleDynamicVersion
258
267
implementation " com.facebook.react:react-native:+" // From node_modules
259
268
260
-
261
269
implementation " androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
270
+
262
271
debugImplementation(" com.facebook.flipper:flipper:${ FLIPPER_VERSION} " ) {
263
272
exclude group :' com.facebook.fbjni'
264
273
}
274
+
265
275
debugImplementation(" com.facebook.flipper:flipper-network-plugin:${ FLIPPER_VERSION} " ) {
266
276
exclude group :' com.facebook.flipper'
267
277
exclude group :' com.squareup.okhttp3' , module :' okhttp'
268
278
}
279
+
269
280
debugImplementation(" com.facebook.flipper:flipper-fresco-plugin:${ FLIPPER_VERSION} " ) {
270
281
exclude group :' com.facebook.flipper'
271
282
}
@@ -278,8 +289,6 @@ dependencies {
278
289
} else {
279
290
implementation jscFlavor
280
291
}
281
-
282
- implementation project(' :react-native-system-bars' )
283
292
}
284
293
285
294
if (isNewArchitectureEnabled()) {
@@ -313,4 +322,4 @@ def isNewArchitectureEnabled() {
313
322
// - Invoke gradle with `-newArchEnabled=true`
314
323
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
315
324
return project. hasProperty(" newArchEnabled" ) && project. newArchEnabled == " true"
316
- }
325
+ }
0 commit comments