@@ -15,10 +15,12 @@ import com.android.build.OutputFile
1515 * // the name of the generated asset file containing your JS bundle
1616 * bundleAssetName: "index.android.bundle",
1717 *
18- * // the entry file for bundle generation
18+ * // the entry file for bundle generation. If none specified and
19+ * // "index.android.js" exists, it will be used. Otherwise "index.js" is
20+ * // default. Can be overridden with ENTRY_FILE environment variable.
1921 * entryFile: "index.android.js",
2022 *
21- * // https://facebook.github.io/react-native /docs/performance#enable-the-ram-format
23+ * // https://reactnative.dev /docs/performance#enable-the-ram-format
2224 * bundleCommand: "ram-bundle",
2325 *
2426 * // whether to bundle JS and assets in debug mode
@@ -76,7 +78,6 @@ import com.android.build.OutputFile
7678 */
7779
7880project. ext. react = [
79- entryFile : " index.js" ,
8081 enableHermes : false , // clean and rebuild if changing
8182]
8283
@@ -119,13 +120,15 @@ def jscFlavor = 'org.webkit:android-jsc:+'
119120 */
120121def enableHermes = project. ext. react. get(" enableHermes" , false );
121122
123+ /**
124+ * Architectures to build native code for in debug.
125+ */
126+ def nativeArchitectures = project. getProperties(). get(" reactNativeDebugArchitectures" )
127+
122128android {
123- compileSdkVersion rootProject. ext. compileSdkVersion
129+ ndkVersion rootProject. ext. ndkVersion
124130
125- compileOptions {
126- sourceCompatibility JavaVersion . VERSION_1_8
127- targetCompatibility JavaVersion . VERSION_1_8
128- }
131+ compileSdkVersion rootProject. ext. compileSdkVersion
129132
130133 defaultConfig {
131134 applicationId " com.example"
@@ -153,25 +156,32 @@ android {
153156 buildTypes {
154157 debug {
155158 signingConfig signingConfigs. debug
159+ if (nativeArchitectures) {
160+ ndk {
161+ abiFilters nativeArchitectures. split(' ,' )
162+ }
163+ }
156164 }
157165 release {
158166 // Caution! In production, you need to generate your own keystore file.
159- // see https://facebook.github.io/react-native /docs/signed-apk-android.
167+ // see https://reactnative.dev /docs/signed-apk-android.
160168 signingConfig signingConfigs. debug
161169 minifyEnabled enableProguardInReleaseBuilds
162170 proguardFiles getDefaultProguardFile(" proguard-android.txt" ), " proguard-rules.pro"
163171 }
164172 }
173+
165174 // applicationVariants are e.g. debug, release
166175 applicationVariants. all { variant ->
167176 variant. outputs. each { output ->
168177 // For each separate APK per architecture, set a unique version code as described here:
169178 // https://developer.android.com/studio/build/configure-apk-splits.html
179+ // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
170180 def versionCodes = [" armeabi-v7a" : 1 , " x86" : 2 , " arm64-v8a" : 3 , " x86_64" : 4 ]
171181 def abi = output. getFilter(OutputFile . ABI )
172182 if (abi != null ) { // null for the universal-debug, universal-release variants
173183 output. versionCodeOverride =
174- versionCodes . get(abi) * 1048576 + defaultConfig . versionCode
184+ defaultConfig . versionCode * 1000 + versionCodes . get(abi)
175185 }
176186
177187 }
@@ -180,8 +190,24 @@ android {
180190
181191dependencies {
182192 implementation fileTree(dir : " libs" , include : [" *.jar" ])
193+ // noinspection GradleDynamicVersion
183194 implementation " com.facebook.react:react-native:+" // From node_modules
184195
196+ implementation " androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
197+
198+ debugImplementation(" com.facebook.flipper:flipper:${ FLIPPER_VERSION} " ) {
199+ exclude group :' com.facebook.fbjni'
200+ }
201+
202+ debugImplementation(" com.facebook.flipper:flipper-network-plugin:${ FLIPPER_VERSION} " ) {
203+ exclude group :' com.facebook.flipper'
204+ exclude group :' com.squareup.okhttp3' , module :' okhttp'
205+ }
206+
207+ debugImplementation(" com.facebook.flipper:flipper-fresco-plugin:${ FLIPPER_VERSION} " ) {
208+ exclude group :' com.facebook.flipper'
209+ }
210+
185211 if (enableHermes) {
186212 def hermesPath = " ../../node_modules/hermes-engine/android/" ;
187213 debugImplementation files(hermesPath + " hermes-debug.aar" )
@@ -194,7 +220,7 @@ dependencies {
194220// Run this once to be able to run the application with BUCK
195221// puts all compile dependencies into folder libs for BUCK to use
196222task copyDownloadableDepsToLibs (type : Copy ) {
197- from configurations. compile
223+ from configurations. implementation
198224 into ' libs'
199225}
200226
0 commit comments