Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
| `rock-build-extra-params` | Extra parameters for rock build:android | No | - |
| `comment-bot` | Whether to comment PR with build link | No | `true` |
| `custom-identifier` | Custom identifier used in artifact naming for re-sign and ad-hoc flows to distinguish builds with the same native fingerprint | No | - |
| `validate-elf-alignment` | Validate 16KB ELF alignment of native libraries (Google Play compliance) | No | `false` |

## Artifact Naming

Expand Down Expand Up @@ -150,6 +151,27 @@ The following mappings are set:

Both conventions are set simultaneously, so the action works with any existing build configuration.

## ELF Alignment Validation

When `validate-elf-alignment: true`, the action verifies that all native shared libraries (`.so` files) in the APK are 16KB page-size aligned, as required by [Google Play for Android 15+ devices](https://developer.android.com/guide/practices/page-sizes).

The check runs **only on fresh builds** (not on cached/downloaded artifacts) and **before** re-signing or uploading. It performs two levels of verification:

1. **Zip-level alignment** via `zipalign -P 16` — checks that `.so` entries are correctly aligned within the APK archive
2. **ELF-level alignment** via `objdump` — inspects each shared library's LOAD segment to confirm `2**14` (16KB) or higher alignment

The command only supports APK files. If the build produces an AAB, the step will fail with a clear error. If any 64-bit library (`arm64-v8a`, `x86_64`) is misaligned, the workflow fails with a list of affected libraries.

Internally this uses `npx rock validate-elf-alignment`, which requires `objdump` available on the runner. `zipalign` from Android build-tools 35.0.0+ is optional but recommended for zip-level checks.

```yaml
- uses: callstackincubator/android@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
variant: 'release'
validate-elf-alignment: true
```

## Prerequisites

- Ubuntu runner
Expand Down
11 changes: 11 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ inputs:
custom-identifier:
description: 'Custom identifier used in artifact naming for re-sign and ad-hoc flows to distinguish builds with the same native fingerprint'
required: false
validate-elf-alignment:
description: 'Validate ELF alignment of native libraries (16KB page size compliance for Google Play)'
required: false
default: 'false'

outputs:
artifact-url:
Expand Down Expand Up @@ -270,6 +274,13 @@ runs:
echo "ARTIFACT_PATH=$BINARY_PATH" >> $GITHUB_ENV
shell: bash

- name: Validate ELF Alignment
if: ${{ inputs.validate-elf-alignment == 'true' && !env.ARTIFACT_URL && env.ARTIFACT_PATH }}
run: |
npx rock validate-elf-alignment "${{ env.ARTIFACT_PATH }}"
shell: bash
working-directory: ${{ inputs.working-directory }}

- name: Download and Unpack Binary
if: ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' }}
run: |
Expand Down