From 1f8f44f2e1dcb4b7bf1fac8b5af813ef2c7549b8 Mon Sep 17 00:00:00 2001 From: Simon K Date: Sun, 18 Aug 2024 16:24:09 +0200 Subject: [PATCH] Shrink apk file size Split apks to arm v7a and v8 --- README.md | 2 +- app/build.gradle.kts | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 516ead8..dca989c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A Android frontend for https://github.com/JimmXinu/FanFicFare -Download apk from ![](app/src/main/res/drawable-mdpi/ic_notification_download.png)[ releases](https://github.com/Octav14n/BoFiLo/releases) +Download apk from ![](app/src/main/res/drawable-mdpi/ic_notification_download.png)[ releases](https://github.com/Octav14n/BoFiLo/releases), if you don't know which Version matches your device, use the one ending in "...-universal-release.apk" ## How to use this App diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 05750c4..8f5c41a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -89,6 +89,34 @@ android { setProperty("archivesBaseName", "BoFiLo_v$versionName") testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + // Ref: https://developer.android.com/studio/build/configure-apk-splits.html#configure-abi-split + splits { + // Configures multiple APKs based on ABI. + abi { + // Enables building multiple APKs per ABI. + var isRelease = false + gradle.startParameter.taskNames.find { + // Enable split for release builds in different build flavors + // (assemblePaidRelease, assembleFreeRelease, etc.). + if (it.matches(Regex(".*assemble.*Release.*"))) { + isRelease = true + return@find true // break + } + + return@find false // continue + } + + isEnable = isRelease + // By default all ABIs are included, so use reset() and include to specify that we only + // want APKs for armeabi-v7a, x86, arm64-v8a and x86_64. + // Resets the list of ABIs that Gradle should create APKs for to none. + reset() + // Specifies a list of ABIs that Gradle should create APKs for. + include("armeabi-v7a", "arm64-v8a") //, "x86", "x86_64") + // Generate a universal APK that includes all ABIs, so user who installs from CI tool can use this one by default. + isUniversalApk = true + } + } ndk { //noinspection ChromeOsAbiSupport