diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index ae8ddc796f8..4c2f9a5a1af 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -224,11 +224,8 @@ def reactNativeInspectorProxyPort() { } def reactNativeArchitectures() { - def isDebug = gradle.startParameter.taskRequests.any { - it.args.any { it.endsWith("Debug") } - } - def value = project.getProperties().get("reactNativeDebugArchitectures") - return value != null && isDebug ? value : "all" + def value = project.getProperties().get("reactNativeArchitectures") + return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } def ndkBuildJobs() { @@ -290,8 +287,7 @@ android { externalNativeBuild { ndkBuild { - arguments "APP_ABI=${reactNativeArchitectures()}", - "NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk", + arguments "NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk", "THIRD_PARTY_NDK_DIR=$thirdPartyNdkDir", "REACT_COMMON_DIR=$projectDir/../ReactCommon", "REACT_GENERATED_SRC_DIR=$buildDir/generated/source", @@ -304,6 +300,9 @@ android { } } } + ndk { + abiFilters (*reactNativeArchitectures()) + } } externalNativeBuild { diff --git a/packages/rn-tester/android/app/build.gradle b/packages/rn-tester/android/app/build.gradle index a2ee432bdb4..b4b543ae352 100644 --- a/packages/rn-tester/android/app/build.gradle +++ b/packages/rn-tester/android/app/build.gradle @@ -133,9 +133,11 @@ def enableFabric = project.ext.react.enableFabric def useIntlJsc = false /** - * Architectures to build native code for in debug. + * Architectures to build native code for. */ -def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures") +def nativeArchitectures = project.getProperties().get("reactNativeArchitectures") ? + project.getProperties().get("reactNativeArchitectures").split(",") + : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] android { compileSdkVersion 29 @@ -183,18 +185,13 @@ android { enable enableSeparateBuildPerCPUArchitecture universalApk false reset() - include "armeabi-v7a", "x86", "x86_64", "arm64-v8a" + include (*nativeArchitectures) } } buildTypes { debug { debuggable true signingConfig signingConfigs.release - if (nativeArchitectures) { - ndk { - abiFilters nativeArchitectures.split(',') - } - } } release { debuggable false diff --git a/template/android/app/build.gradle b/template/android/app/build.gradle index 022855a20b9..04130f5c713 100644 --- a/template/android/app/build.gradle +++ b/template/android/app/build.gradle @@ -121,10 +121,11 @@ def jscFlavor = 'org.webkit:android-jsc:+' def enableHermes = project.ext.react.get("enableHermes", false); /** - * Architectures to build native code for in debug. + * Architectures to build native code for. */ -def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures") - +def nativeArchitectures = project.getProperties().get("reactNativeArchitectures") ? + project.getProperties().get("reactNativeArchitectures").split(",") + : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] android { ndkVersion rootProject.ext.ndkVersion @@ -142,7 +143,7 @@ android { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK - include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" + include (*nativeArchitectures) } } signingConfigs { @@ -156,11 +157,6 @@ android { buildTypes { debug { signingConfig signingConfigs.debug - if (nativeArchitectures) { - ndk { - abiFilters nativeArchitectures.split(',') - } - } } release { // Caution! In production, you need to generate your own keystore file.