1
1
apply plugin : " com.android.application"
2
2
apply plugin : " com.facebook.react"
3
3
4
- import com.android.build.OutputFile
5
-
6
4
def projectRoot = rootDir. getAbsoluteFile(). getParentFile(). getAbsolutePath()
7
- def expoDebuggableVariants = [' debug' ]
8
- // Override `debuggableVariants` for expo-updates debugging
9
- if (System . getenv(' EX_UPDATES_NATIVE_DEBUG' ) == " 1" ) {
10
- react {
11
- expoDebuggableVariants = []
12
- }
13
- }
14
-
15
5
16
6
/**
17
7
* This is the configuration block to customize your React Native Android app.
@@ -21,17 +11,20 @@ react {
21
11
entryFile = file([" node" , " -e" , " require('expo/scripts/resolveAppEntry')" , projectRoot, " android" , " absolute" ]. execute(null , rootDir). text. trim())
22
12
reactNativeDir = new File ([" node" , " --print" , " require.resolve('react-native/package.json')" ]. execute(null , rootDir). text. trim()). getParentFile(). getAbsoluteFile()
23
13
hermesCommand = new File ([" node" , " --print" , " require.resolve('react-native/package.json')" ]. execute(null , rootDir). text. trim()). getParentFile(). getAbsolutePath() + " /sdks/hermesc/%OS-BIN%/hermesc"
24
- debuggableVariants = expoDebuggableVariants
14
+ codegenDir = new File ([" node" , " --print" , " require.resolve('@react-native/codegen/package.json')" ]. execute(null , rootDir). text. trim()). getParentFile(). getAbsoluteFile()
15
+
16
+ // Use Expo CLI to bundle the app, this ensures the Metro config
17
+ // works correctly with Expo projects.
18
+ cliFile = new File ([" node" , " --print" , " require.resolve('@expo/cli')" ]. execute(null , rootDir). text. trim())
19
+ bundleCommand = " export:embed"
25
20
26
21
/* Folders */
27
22
// The root of your project, i.e. where "package.json" lives. Default is '..'
28
23
// root = file("../")
29
24
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
30
25
// reactNativeDir = file("../node_modules/react-native")
31
- // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
32
- // codegenDir = file("../node_modules/react-native-codegen")
33
- // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
34
- // cliFile = file("../node_modules/react-native/cli.js")
26
+ // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
27
+ // codegenDir = file("../node_modules/@react-native/codegen")
35
28
36
29
/* Variants */
37
30
// The list of variants to that are debuggable. For those we're going to
@@ -42,9 +35,7 @@ react {
42
35
/* Bundling */
43
36
// A list containing the node command and its flags. Default is just 'node'.
44
37
// nodeExecutableAndArgs = ["node"]
45
- //
46
- // The command to run when bundling. By default is 'bundle'
47
- // bundleCommand = "ram-bundle"
38
+
48
39
//
49
40
// The path to the CLI configuration file. Default is empty.
50
41
// bundleConfig = file(../rn-cli.config.js)
@@ -67,19 +58,6 @@ react {
67
58
// hermesFlags = ["-O", "-output-source-map"]
68
59
}
69
60
70
- // Override `hermesEnabled` by `expo.jsEngine`
71
- ext {
72
- hermesEnabled = (findProperty(' expo.jsEngine' ) ?: " hermes" ) == " hermes"
73
- }
74
-
75
- /**
76
- * Set this to true to create four separate APKs instead of one,
77
- * one for each native architecture. This is useful if you don't
78
- * use App Bundles (https://developer.android.com/guide/app-bundle/)
79
- * and want to have separate APKs to upload to the Play Store.
80
- */
81
- def enableSeparateBuildPerCPUArchitecture = false
82
-
83
61
/**
84
62
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
85
63
*/
@@ -98,16 +76,6 @@ def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInRelea
98
76
*/
99
77
def jscFlavor = ' org.webkit:android-jsc:+'
100
78
101
- /**
102
- * Private function to get the list of Native Architectures you want to build.
103
- * This reads the value from reactNativeArchitectures in your gradle.properties
104
- * file and works together with the --active-arch-only flag of react-native run-android.
105
- */
106
- def reactNativeArchitectures () {
107
- def value = project. getProperties(). get(" reactNativeArchitectures" )
108
- return value ? value. split(" ," ) : [" armeabi-v7a" , " x86" , " x86_64" , " arm64-v8a" ]
109
- }
110
-
111
79
android {
112
80
ndkVersion rootProject. ext. ndkVersion
113
81
@@ -119,16 +87,9 @@ android {
119
87
minSdkVersion rootProject. ext. minSdkVersion
120
88
targetSdkVersion rootProject. ext. targetSdkVersion
121
89
versionCode 1
122
- versionName " 1.0"
123
- }
90
+ versionName " 1.0.0"
124
91
125
- splits {
126
- abi {
127
- reset()
128
- enable enableSeparateBuildPerCPUArchitecture
129
- universalApk false // If true, also generate a universal APK
130
- include (* reactNativeArchitectures())
131
- }
92
+ buildConfigField(" boolean" , " REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS" , (findProperty(" reactNative.unstable_useRuntimeSchedulerAlways" ) ?: true ). toString())
132
93
}
133
94
signingConfigs {
134
95
debug {
@@ -151,22 +112,6 @@ android {
151
112
proguardFiles getDefaultProguardFile(" proguard-android.txt" ), " proguard-rules.pro"
152
113
}
153
114
}
154
-
155
- // applicationVariants are e.g. debug, release
156
- applicationVariants. all { variant ->
157
- variant. outputs. each { output ->
158
- // For each separate APK per architecture, set a unique version code as described here:
159
- // https://developer.android.com/studio/build/configure-apk-splits.html
160
- // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
161
- def versionCodes = [" armeabi-v7a" : 1 , " x86" : 2 , " arm64-v8a" : 3 , " x86_64" : 4 ]
162
- def abi = output. getFilter(OutputFile . ABI )
163
- if (abi != null ) { // null for the universal-debug, universal-release variants
164
- output. versionCodeOverride =
165
- defaultConfig. versionCode * 1000 + versionCodes. get(abi)
166
- }
167
-
168
- }
169
- }
170
115
}
171
116
172
117
// Apply static values from `gradle.properties` to the `android.packagingOptions`
@@ -218,8 +163,6 @@ dependencies {
218
163
}
219
164
}
220
165
221
- implementation(" androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" )
222
-
223
166
debugImplementation(" com.facebook.flipper:flipper:${ FLIPPER_VERSION} " )
224
167
debugImplementation(" com.facebook.flipper:flipper-network-plugin:${ FLIPPER_VERSION} " ) {
225
168
exclude group :' com.squareup.okhttp3' , module :' okhttp'
0 commit comments