From 7605a71a96d7d3c9b2dca15bed5650eac08624d2 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Tue, 2 Jan 2024 02:46:22 +0100 Subject: [PATCH] split apks per ABI --- .github/workflows/android.yml | 4 ++-- platforms/android/app/build.gradle | 23 ++++++++++++++++++----- platforms/build-android.sh | 3 --- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 89e41588..4d889e32 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -56,5 +56,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: oopetris.aab - path: platforms/android/app/build/outputs/apk/debug/app-debug.apk + name: oopetris.all-apks + path: platforms/android/app/build/outputs/apk/debug/app-*-debug.apk diff --git a/platforms/android/app/build.gradle b/platforms/android/app/build.gradle index 80f5f4c4..f92a4a52 100644 --- a/platforms/android/app/build.gradle +++ b/platforms/android/app/build.gradle @@ -15,17 +15,14 @@ android { } minSdkVersion 21 targetSdkVersion 34 - versionCode 2 - versionName "1.0.2" + versionCode 3 + versionName "1.0.3" externalNativeBuild { ndkBuild { arguments "APP_PLATFORM=android-34" abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' } } - ndk { - abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' - } } buildTypes { release { @@ -63,6 +60,22 @@ android { } } } + splits { + // Configures multiple APKs based on ABI. + abi { + // Enables building multiple APKs per ABI. + enable true + // By default all ABIs are included, so use reset() and include to specify that you only + // want APKs for the ones with a ndk variant (4, android did in the past support more: https://developer.android.com/ndk/guides/abis.html#sa) + // Resets the list of ABIs for Gradle to create APKs for to none. + reset() + // Specifies a list of ABIs for Gradle to create APKs for. + include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' + // Specifies that you don't want to also generate a universal APK that includes all ABIs. + universalApk false + } + } + } dependencies { diff --git a/platforms/build-android.sh b/platforms/build-android.sh index 63352336..b58b7ec7 100755 --- a/platforms/build-android.sh +++ b/platforms/build-android.sh @@ -259,6 +259,3 @@ for IDX in "${!DESC_ARRAY[@]}"; do cp -r "./assets/icon/icon_$RES.png" "${DESC_DIR}/ic_launcher.png" done - - -# TODO: build seperate apks for all 4 architectures!