feat: Introduce Gradle property to control APK splits (#560)

* feat: Introduce Gradle property to control APK splits

This commit introduces a new Gradle project property, `buildSplitApks`, to conditionally enable or disable the generation of ABI-specific (arm64, x86_64) and universal APKs.

Key changes:
- In `app/build.gradle.kts`, the `splits.abi.isEnable` flag is now dynamically set based on the `buildSplitApks` property.
- APK splitting is disabled by default to support standard Android App Bundle (`bundleRelease`) builds.
- The release workflow (`release.yml`) is updated to pass `-PbuildSplitApks=true` when building release APKs for GitHub.
- The general Android build workflow (`android-build.yml`) is also modified to enable splits only for the `Release` variant, ensuring debug builds are not affected.

* chore: Simplify and automate APK split builds

This commit simplifies the build process by automatically enabling ABI splits for APKs (`assemble`) and disabling them for AABs (`bundle`).

This removes the need to manually pass the `-PbuildSplitApks=true` property. The build script now intelligently determines whether to create architecture-specific APKs based on the task being executed (e.g., `assembleRelease` vs. `bundleRelease`).

The GitHub Actions workflows (`release.yml`, `android-build.yml`) have been updated to remove this now-redundant property, streamlining the CI configuration.
This commit is contained in:
Moe Hamade
2026-01-16 01:06:15 +07:00
committed by GitHub
parent e07bee5a75
commit 5013b32ca9
+8 -1
View File
@@ -48,9 +48,16 @@ android {
// APK splits for GitHub releases - creates arm64, x86_64, and universal APKs
// AAB for Play Store handles architecture distribution automatically
// Auto-detects: splits enabled for assemble tasks, disabled for bundle tasks
// Works in Android Studio GUI and CLI without needing extra properties
val enableSplits = gradle.startParameter.taskNames.any { taskName ->
taskName.contains("assemble", ignoreCase = true) &&
!taskName.contains("bundle", ignoreCase = true)
}
splits {
abi {
isEnable = true
isEnable = enableSplits
reset()
include("arm64-v8a", "x86_64", "armeabi-v7a", "x86")
isUniversalApk = true // For F-Droid and fallback