@@ -2,17 +2,7 @@ apply plugin: "com.android.application"
2
2
apply plugin : " org.jetbrains.kotlin.android"
3
3
apply plugin : " com.facebook.react"
4
4
5
- import com.android.build.OutputFile
6
-
7
5
def projectRoot = rootDir. getAbsoluteFile(). getParentFile(). getAbsolutePath()
8
- def expoDebuggableVariants = [' debug' ]
9
- // Override `debuggableVariants` for expo-updates debugging
10
- if (System . getenv(' EX_UPDATES_NATIVE_DEBUG' ) == " 1" ) {
11
- react {
12
- expoDebuggableVariants = []
13
- }
14
- }
15
-
16
6
17
7
/**
18
8
* This is the configuration block to customize your React Native Android app.
@@ -22,17 +12,20 @@ react {
22
12
entryFile = file([" node" , " -e" , " require('expo/scripts/resolveAppEntry')" , projectRoot, " android" , " absolute" ]. execute(null , rootDir). text. trim())
23
13
reactNativeDir = new File ([" node" , " --print" , " require.resolve('react-native/package.json')" ]. execute(null , rootDir). text. trim()). getParentFile(). getAbsoluteFile()
24
14
hermesCommand = new File ([" node" , " --print" , " require.resolve('react-native/package.json')" ]. execute(null , rootDir). text. trim()). getParentFile(). getAbsolutePath() + " /sdks/hermesc/%OS-BIN%/hermesc"
25
- debuggableVariants = expoDebuggableVariants
15
+ codegenDir = new File ([" node" , " --print" , " require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })" ]. execute(null , rootDir). text. trim()). getParentFile(). getAbsoluteFile()
16
+
17
+ // Use Expo CLI to bundle the app, this ensures the Metro config
18
+ // works correctly with Expo projects.
19
+ cliFile = new File ([" node" , " --print" , " require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })" ]. execute(null , rootDir). text. trim())
20
+ bundleCommand = " export:embed"
26
21
27
22
/* Folders */
28
- // The root of your project, i.e. where "package.json" lives. Default is '..'
29
- // root = file("../")
30
- // The folder where the react-native NPM package is. Default is ../node_modules/react-native
31
- // reactNativeDir = file("../node_modules/react-native")
32
- // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
33
- // codegenDir = file("../node_modules/react-native-codegen")
34
- // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
35
- // cliFile = file("../node_modules/react-native/cli.js")
23
+ // The root of your project, i.e. where "package.json" lives. Default is '../..'
24
+ // root = file("../../")
25
+ // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
26
+ // reactNativeDir = file("../../node_modules/react-native")
27
+ // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
28
+ // codegenDir = file("../../node_modules/@react-native/codegen")
36
29
37
30
/* Variants */
38
31
// The list of variants to that are debuggable. For those we're going to
@@ -43,9 +36,7 @@ react {
43
36
/* Bundling */
44
37
// A list containing the node command and its flags. Default is just 'node'.
45
38
// nodeExecutableAndArgs = ["node"]
46
- //
47
- // The command to run when bundling. By default is 'bundle'
48
- // bundleCommand = "ram-bundle"
39
+
49
40
//
50
41
// The path to the CLI configuration file. Default is empty.
51
42
// bundleConfig = file(../rn-cli.config.js)
@@ -67,22 +58,10 @@ react {
67
58
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
68
59
// hermesFlags = ["-O", "-output-source-map"]
69
60
61
+ /* Autolinking */
70
62
autolinkLibrariesWithApp()
71
63
}
72
64
73
- // Override `hermesEnabled` by `expo.jsEngine`
74
- ext {
75
- hermesEnabled = (findProperty(' expo.jsEngine' ) ?: " hermes" ) == " hermes"
76
- }
77
-
78
- /**
79
- * Set this to true to create four separate APKs instead of one,
80
- * one for each native architecture. This is useful if you don't
81
- * use App Bundles (https://developer.android.com/guide/app-bundle/)
82
- * and want to have separate APKs to upload to the Play Store.
83
- */
84
- def enableSeparateBuildPerCPUArchitecture = false
85
-
86
65
/**
87
66
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
88
67
*/
@@ -101,21 +80,11 @@ def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInRelea
101
80
*/
102
81
def jscFlavor = ' org.webkit:android-jsc:+'
103
82
104
- /**
105
- * Private function to get the list of Native Architectures you want to build.
106
- * This reads the value from reactNativeArchitectures in your gradle.properties
107
- * file and works together with the --active-arch-only flag of react-native run-android.
108
- */
109
- def reactNativeArchitectures () {
110
- def value = project. getProperties(). get(" reactNativeArchitectures" )
111
- return value ? value. split(" ," ) : [" armeabi-v7a" , " x86" , " x86_64" , " arm64-v8a" ]
112
- }
113
-
114
83
android {
115
84
ndkVersion rootProject. ext. ndkVersion
116
85
117
86
buildToolsVersion rootProject. ext. buildToolsVersion
118
- compileSdkVersion rootProject. ext. compileSdkVersion
87
+ compileSdk rootProject. ext. compileSdkVersion
119
88
120
89
namespace ' com.callstack.reactnativepaperexample'
121
90
defaultConfig {
@@ -125,15 +94,6 @@ android {
125
94
versionCode 28
126
95
versionName " 3.14.0"
127
96
}
128
-
129
- splits {
130
- abi {
131
- reset()
132
- enable enableSeparateBuildPerCPUArchitecture
133
- universalApk false // If true, also generate a universal APK
134
- include (* reactNativeArchitectures())
135
- }
136
- }
137
97
signingConfigs {
138
98
debug {
139
99
storeFile file(' debug.keystore' )
@@ -153,24 +113,17 @@ android {
153
113
shrinkResources (findProperty(' android.enableShrinkResourcesInReleaseBuilds' )?. toBoolean() ?: false )
154
114
minifyEnabled enableProguardInReleaseBuilds
155
115
proguardFiles getDefaultProguardFile(" proguard-android.txt" ), " proguard-rules.pro"
116
+ crunchPngs (findProperty(' android.enablePngCrunchInReleaseBuilds' )?. toBoolean() ?: true )
156
117
}
157
118
}
158
-
159
- // applicationVariants are e.g. debug, release
160
- applicationVariants. all { variant ->
161
- variant. outputs. each { output ->
162
- // For each separate APK per architecture, set a unique version code as described here:
163
- // https://developer.android.com/studio/build/configure-apk-splits.html
164
- // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
165
- def versionCodes = [" armeabi-v7a" : 1 , " x86" : 2 , " arm64-v8a" : 3 , " x86_64" : 4 ]
166
- def abi = output. getFilter(OutputFile . ABI )
167
- if (abi != null ) { // null for the universal-debug, universal-release variants
168
- output. versionCodeOverride =
169
- defaultConfig. versionCode * 1000 + versionCodes. get(abi)
170
- }
171
-
119
+ packagingOptions {
120
+ jniLibs {
121
+ useLegacyPackaging (findProperty(' expo.useLegacyPackaging' )?. toBoolean() ?: false )
172
122
}
173
123
}
124
+ androidResources {
125
+ ignoreAssetsPattern ' !.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~'
126
+ }
174
127
}
175
128
176
129
// Apply static values from `gradle.properties` to the `android.packagingOptions`
@@ -200,35 +153,24 @@ dependencies {
200
153
def isGifEnabled = (findProperty(' expo.gif.enabled' ) ?: " " ) == " true" ;
201
154
def isWebpEnabled = (findProperty(' expo.webp.enabled' ) ?: " " ) == " true" ;
202
155
def isWebpAnimatedEnabled = (findProperty(' expo.webp.animated' ) ?: " " ) == " true" ;
203
- def frescoVersion = rootProject. ext. frescoVersion
204
-
205
- // If your app supports Android versions before Ice Cream Sandwich (API level 14)
206
- if (isGifEnabled || isWebpEnabled) {
207
- implementation(" com.facebook.fresco:fresco:${ frescoVersion} " )
208
- implementation(" com.facebook.fresco:imagepipeline-okhttp3:${ frescoVersion} " )
209
- }
210
156
211
157
if (isGifEnabled) {
212
158
// For animated gif support
213
- implementation(" com.facebook.fresco:animated-gif:${ frescoVersion } " )
159
+ implementation(" com.facebook.fresco:animated-gif:${ reactAndroidLibs.versions.fresco.get() } " )
214
160
}
215
161
216
162
if (isWebpEnabled) {
217
163
// For webp support
218
- implementation(" com.facebook.fresco:webpsupport:${ frescoVersion } " )
164
+ implementation(" com.facebook.fresco:webpsupport:${ reactAndroidLibs.versions.fresco.get() } " )
219
165
if (isWebpAnimatedEnabled) {
220
166
// Animated webp support
221
- implementation(" com.facebook.fresco:animated-webp:${ frescoVersion } " )
167
+ implementation(" com.facebook.fresco:animated-webp:${ reactAndroidLibs.versions.fresco.get() } " )
222
168
}
223
169
}
224
170
225
- implementation(" androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" )
226
-
227
171
if (hermesEnabled. toBoolean()) {
228
172
implementation(" com.facebook.react:hermes-android" )
229
173
} else {
230
174
implementation jscFlavor
231
175
}
232
176
}
233
-
234
- applyNativeModulesAppBuildGradle(project)
0 commit comments