@@ -20,7 +20,7 @@ import com.android.build.OutputFile
2020 * // default. Can be overridden with ENTRY_FILE environment variable.
2121 * entryFile: "index.android.js",
2222 *
23- * // https://facebook.github.io/react-native /docs/performance#enable-the-ram-format
23+ * // https://reactnative.dev /docs/performance#enable-the-ram-format
2424 * bundleCommand: "ram-bundle",
2525 *
2626 * // whether to bundle JS and assets in debug mode
@@ -120,16 +120,18 @@ def jscFlavor = 'org.webkit:android-jsc:+'
120120 */
121121def enableHermes = project. ext. react. get(" enableHermes" , false );
122122
123+ /**
124+ * Architectures to build native code for in debug.
125+ */
126+ def nativeArchitectures = project. getProperties(). get(" reactNativeDebugArchitectures" )
127+
123128android {
124- compileSdkVersion rootProject. ext. compileSdkVersion
129+ ndkVersion rootProject. ext. ndkVersion
125130
126- compileOptions {
127- sourceCompatibility JavaVersion . VERSION_1_8
128- targetCompatibility JavaVersion . VERSION_1_8
129- }
131+ compileSdkVersion rootProject. ext. compileSdkVersion
130132
131133 defaultConfig {
132- applicationId " com.samplesimpledialogs "
134+ applicationId " com.sample "
133135 minSdkVersion rootProject. ext. minSdkVersion
134136 targetSdkVersion rootProject. ext. targetSdkVersion
135137 versionCode 1
@@ -154,33 +156,32 @@ android {
154156 buildTypes {
155157 debug {
156158 signingConfig signingConfigs. debug
159+ if (nativeArchitectures) {
160+ ndk {
161+ abiFilters nativeArchitectures. split(' ,' )
162+ }
163+ }
157164 }
158165 release {
159166 // Caution! In production, you need to generate your own keystore file.
160- // see https://facebook.github.io/react-native /docs/signed-apk-android.
167+ // see https://reactnative.dev /docs/signed-apk-android.
161168 signingConfig signingConfigs. debug
162169 minifyEnabled enableProguardInReleaseBuilds
163170 proguardFiles getDefaultProguardFile(" proguard-android.txt" ), " proguard-rules.pro"
164171 }
165172 }
166173
167- packagingOptions {
168- pickFirst " lib/armeabi-v7a/libc++_shared.so"
169- pickFirst " lib/arm64-v8a/libc++_shared.so"
170- pickFirst " lib/x86/libc++_shared.so"
171- pickFirst " lib/x86_64/libc++_shared.so"
172- }
173-
174174 // applicationVariants are e.g. debug, release
175175 applicationVariants. all { variant ->
176176 variant. outputs. each { output ->
177177 // For each separate APK per architecture, set a unique version code as described here:
178178 // https://developer.android.com/studio/build/configure-apk-splits.html
179+ // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
179180 def versionCodes = [" armeabi-v7a" : 1 , " x86" : 2 , " arm64-v8a" : 3 , " x86_64" : 4 ]
180181 def abi = output. getFilter(OutputFile . ABI )
181182 if (abi != null ) { // null for the universal-debug, universal-release variants
182183 output. versionCodeOverride =
183- versionCodes . get(abi) * 1048576 + defaultConfig . versionCode
184+ defaultConfig . versionCode * 1000 + versionCodes . get(abi)
184185 }
185186
186187 }
@@ -195,11 +196,12 @@ dependencies {
195196 implementation " androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
196197
197198 debugImplementation(" com.facebook.flipper:flipper:${ FLIPPER_VERSION} " ) {
198- exclude group :' com.facebook.fbjni'
199+ exclude group :' com.facebook.fbjni'
199200 }
200201
201202 debugImplementation(" com.facebook.flipper:flipper-network-plugin:${ FLIPPER_VERSION} " ) {
202203 exclude group :' com.facebook.flipper'
204+ exclude group :' com.squareup.okhttp3' , module :' okhttp'
203205 }
204206
205207 debugImplementation(" com.facebook.flipper:flipper-fresco-plugin:${ FLIPPER_VERSION} " ) {
@@ -218,7 +220,7 @@ dependencies {
218220// Run this once to be able to run the application with BUCK
219221// puts all compile dependencies into folder libs for BUCK to use
220222task copyDownloadableDepsToLibs (type : Copy ) {
221- from configurations. compile
223+ from configurations. implementation
222224 into ' libs'
223225}
224226
0 commit comments