mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-04 03:06:41 -04:00
Merge pull request #4274 from kiwix/Fixes#4273
Fixed: After upgrading Gradle, we were unable to upload the AAB because APK splitting was enabled.
This commit is contained in:
commit
bb25fcaaf5
14
.github/workflows/dummy_bundle_and_apk.yml
vendored
14
.github/workflows/dummy_bundle_and_apk.yml
vendored
@ -32,14 +32,24 @@ jobs:
|
|||||||
echo "KIWIX_ANDROID_RELEASE_DATE=$DATE" >> $GITHUB_ENV
|
echo "KIWIX_ANDROID_RELEASE_DATE=$DATE" >> $GITHUB_ENV
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Generate dummy Bundle and APKs
|
- name: Generate dummy Bundle
|
||||||
env:
|
env:
|
||||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||||
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||||
KIWIX_ANDROID_RELEASE_DATE: ${{ env.KIWIX_ANDROID_RELEASE_DATE }}
|
KIWIX_ANDROID_RELEASE_DATE: ${{ env.KIWIX_ANDROID_RELEASE_DATE }}
|
||||||
run: |
|
run: |
|
||||||
./gradlew bundlePlayStore assembleRelease --scan
|
./gradlew bundlePlayStore --scan
|
||||||
|
|
||||||
|
- name: Generate dummy APKs
|
||||||
|
env:
|
||||||
|
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||||
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||||
|
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||||
|
KIWIX_ANDROID_RELEASE_DATE: ${{ env.KIWIX_ANDROID_RELEASE_DATE }}
|
||||||
|
APK_BUILD: "true"
|
||||||
|
run: |
|
||||||
|
./gradlew assembleRelease --scan
|
||||||
|
|
||||||
|
|
||||||
- name: Get Bundle and APKs name and path
|
- name: Get Bundle and APKs name and path
|
||||||
|
1
.github/workflows/nightly.yml
vendored
1
.github/workflows/nightly.yml
vendored
@ -36,6 +36,7 @@ jobs:
|
|||||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||||
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||||
|
APK_BUILD: "true"
|
||||||
run: ./gradlew assembleNightly
|
run: ./gradlew assembleNightly
|
||||||
|
|
||||||
- name: Set date variable
|
- name: Set date variable
|
||||||
|
2
.github/workflows/pull_request.yml
vendored
2
.github/workflows/pull_request.yml
vendored
@ -138,6 +138,8 @@ jobs:
|
|||||||
distribution: temurin
|
distribution: temurin
|
||||||
|
|
||||||
- name: Build all configurations
|
- name: Build all configurations
|
||||||
|
env:
|
||||||
|
APK_BUILD: "true"
|
||||||
run: ./gradlew assemble
|
run: ./gradlew assemble
|
||||||
|
|
||||||
- name: Upload APK as Artifacts
|
- name: Upload APK as Artifacts
|
||||||
|
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@ -45,6 +45,7 @@ jobs:
|
|||||||
UNIVERSAL_RELEASE_APK: app/build/outputs/apk/standalone/*universal*.apk
|
UNIVERSAL_RELEASE_APK: app/build/outputs/apk/standalone/*universal*.apk
|
||||||
ARCHIVE_NAME: org.kiwix.kiwixmobile.standalone-${{ github.event.release.tag_name }}.apk
|
ARCHIVE_NAME: org.kiwix.kiwixmobile.standalone-${{ github.event.release.tag_name }}.apk
|
||||||
KIWIX_ANDROID_RELEASE_DATE: ${{ env.KIWIX_ANDROID_RELEASE_DATE }}
|
KIWIX_ANDROID_RELEASE_DATE: ${{ env.KIWIX_ANDROID_RELEASE_DATE }}
|
||||||
|
APK_BUILD: "true"
|
||||||
run: |
|
run: |
|
||||||
./gradlew assembleStandalone
|
./gradlew assembleStandalone
|
||||||
cp ${UNIVERSAL_RELEASE_APK} ${ARCHIVE_NAME}
|
cp ${UNIVERSAL_RELEASE_APK} ${ARCHIVE_NAME}
|
||||||
|
@ -90,6 +90,12 @@ Kiwix Android is a multi-module project, in 99% of scenarios you will want to bu
|
|||||||
|
|
||||||
We have an [automatic version code generation](https://github.com/kiwix/kiwix-android/blob/main/buildSrc/src/main/kotlin/VersionCodeGenerator.kt) system based on the current date. However, you can override this by setting the environment variable `KIWIX_ANDROID_RELEASE_DATE` to a specific date in the `YYYY-MM-DD` format. This will use the provided date for the version code calculation instead of the current date.
|
We have an [automatic version code generation](https://github.com/kiwix/kiwix-android/blob/main/buildSrc/src/main/kotlin/VersionCodeGenerator.kt) system based on the current date. However, you can override this by setting the environment variable `KIWIX_ANDROID_RELEASE_DATE` to a specific date in the `YYYY-MM-DD` format. This will use the provided date for the version code calculation instead of the current date.
|
||||||
|
|
||||||
|
### ABI Splitting for APKs
|
||||||
|
|
||||||
|
By default, `ABI` splitting is disabled. In newer Gradle versions, when uploading a `.aab` file, `ABI` splitting must remain disabled.
|
||||||
|
However, if you need to generate separate APKs for different ABIs, you can enable `ABI` splitting by setting the `APK_BUILD="true"` environment variable.
|
||||||
|
This variable should only be set when building an APK. If you set this variable and attempt to generate a `.aab` file, the build will fail due to Gradle's new enhancements.
|
||||||
|
|
||||||
## Libraries Used
|
## Libraries Used
|
||||||
|
|
||||||
- 📚 [Libkiwix](https://github.com/kiwix/java-libkiwix) - Kotlin/Java binding for the core Kiwix library.
|
- 📚 [Libkiwix](https://github.com/kiwix/java-libkiwix) - Kotlin/Java binding for the core Kiwix library.
|
||||||
|
@ -68,7 +68,20 @@ class AppConfigurer {
|
|||||||
val abiCodes = mapOf("arm64-v8a" to 6, "x86" to 3, "x86_64" to 4, "armeabi-v7a" to 5)
|
val abiCodes = mapOf("arm64-v8a" to 6, "x86" to 3, "x86_64" to 4, "armeabi-v7a" to 5)
|
||||||
splits {
|
splits {
|
||||||
abi {
|
abi {
|
||||||
isEnable = true
|
// Enable ABI splits only when needed (e.g., when building APKs).
|
||||||
|
// This prevents unnecessary splits when generating an App Bundle (AAB),
|
||||||
|
// as AABs already handle ABI splits automatically.
|
||||||
|
//
|
||||||
|
// The environment variable `APK_BUILD` controls this behavior:
|
||||||
|
// - If set to `"true"`, ABI splits are **enabled** (for APK builds).
|
||||||
|
// - If `"false"` or unset, ABI splits are **disabled** (for App Bundles).
|
||||||
|
//
|
||||||
|
// This approach ensures that:
|
||||||
|
// - **App Bundles (AABs)** remain unaffected (since Google Play handles ABI splits).
|
||||||
|
// - **APK builds** get ABI splits when needed for direct distribution (e.g., custom deployments).
|
||||||
|
//
|
||||||
|
// See: https://github.com/kiwix/kiwix-android/issues/4273
|
||||||
|
isEnable = System.getenv("APK_BUILD")?.toBoolean() ?: false
|
||||||
reset()
|
reset()
|
||||||
include(*abiCodes.keys.toTypedArray())
|
include(*abiCodes.keys.toTypedArray())
|
||||||
isUniversalApk = true
|
isUniversalApk = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user