Skip to content

Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.

Build :office_engine only for bundle tasks so release APKs assemble

Chethan61658721a5e33e9
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index a5e7e9b..0286d8f 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -97,7 +97,12 @@ android {
dimension = "distribution"
}
}
- dynamicFeatures += setOf(":office_engine")
+ // AGP can't link a dynamic feature against ABI-split APK outputs, and the feature is only
+ // ever delivered through a Play bundle anyway — so register it for bundle builds only.
+ // APK builds (sideload/foss) simply don't contain it; the play installer then falls back.
+ if (gradle.startParameter.taskNames.any { it.contains("bundle", ignoreCase = true) }) {
+ dynamicFeatures += setOf(":office_engine")
+ }
// Bundling on-device OCR (bundled ML Kit + Tesseract4Android) added native .so libs for
// 4 CPU architectures; without splitting, every install carries all 4. This produces one
// APK per ABI (~1/4 the native-lib weight each) plus a universal fallback for sideloading.
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 6b1ca8f..88643ef 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -29,4 +29,8 @@ include(":backdrop")
include(":pdf-core")
include(":ocr-core")
include(":app")
-include(":office_engine")
+// The Play Feature Delivery module only makes sense inside an app bundle, and AGP can't build it
+// next to the app's ABI-split APKs — so it joins the build only for bundle tasks.
+if (gradle.startParameter.taskNames.any { it.contains("bundle", ignoreCase = true) }) {
+ include(":office_engine")
+}