build(#354): reduce app size by separating builds

This commit is contained in:
Paolo Miguel de Leon
2023-01-20 16:41:06 +08:00
parent 26de1b4cb0
commit 5b924c2ff3

View File

@@ -102,7 +102,7 @@ apply from: new File(["node", "--print", "require.resolve('react-native/package.
* Upload all the APKs to the Play Store and people will download * Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device. * the correct one based on the CPU architecture of their device.
*/ */
def enableSeparateBuildPerCPUArchitecture = false def enableSeparateBuildPerCPUArchitecture = true
/** /**
* Run Proguard to shrink the Java bytecode in release builds. * Run Proguard to shrink the Java bytecode in release builds.
@@ -172,7 +172,7 @@ android {
abi { abi {
reset() reset()
enable enableSeparateBuildPerCPUArchitecture enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK universalApk true // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
} }
} }
@@ -240,9 +240,10 @@ android {
} }
android.applicationVariants.all { variant -> android.applicationVariants.all { variant ->
variant.outputs.all { variant.outputs.all { output ->
def datetime = new Date().format('yyyyMMdd_HHmm') def datetime = new Date().format('yyyyMMdd_HHmm')
outputFileName = "${defaultConfig.applicationId}-${variant.versionName}_${datetime}.apk" def architecture = output.getFilter(com.android.build.OutputFile.ABI) ?: "universal"
outputFileName = "${defaultConfig.applicationId}-${variant.versionName}_${datetime}_${architecture}.apk"
} }
} }
} }