Skip to content

build(#1580): ship the arm64-v8a/x86_64 Android JNI model host in the AAR (Decision 108, slice 3/3) - #1620

Merged
enricopiovesan merged 1 commit into
mainfrom
claude/issue-1580-android-aar
Oct 2, 2026
Merged

enricopiovesan merged 1 commit into
mainfrom
claude/issue-1580-android-aar

Conversation

@enricopiovesan

Copy link
Copy Markdown
Collaborator

Summary

Slice 3 of 3 for #1580 (Decision 108): the published traverse-embedder AAR now ships the native model engine (libtraverse_android_host.so) for arm64-v8a (phones) and x86_64 (emulators). Without it, every model call on a device fails closed with engine_unavailable.

  • scripts/build_android_host_ndk.sh cross-builds traverse-android-host with cargo-ndk 4.1.2 at API 28 (the embedder's minSdk) into <jniLibs>/<abi>/. It uses the NDK from ANDROID_NDK_HOME / ANDROID_NDK_LATEST_HOME, which GitHub runners provide. It links with 16 KB page alignment (-z max-page-size=16384, required for Android 15+) and then verifies each library:
    • it exports exactly Java_dev_traverse_embedder_ExactModelNative_modelCall, the one audited JNI method from ADR-0079;
    • every LOAD segment is aligned to 0x4000.
  • Gradle: sourceSets["main"].jniLibs.srcDir(build/jniLibs), so the libraries ship inside the AAR and nothing binary is committed.
  • scripts/ci/android_aar_check.sh fails if the AAR lacks either ABI.
  • CI:
    • a new android-native-package job (Ubuntu, Rust Android targets, cargo-ndk) cross-builds, assembles the release AAR, and runs the AAR check on every full-CI PR;
    • the Maven publish job cross-builds and verifies the AAR before publishToMavenCentral.
  • Docs (embedder table) and release notes are updated, and Spec 138 governs gains both scripts.

This machine has no Android NDK, so the cross-build itself is proven by this PR's new android-native-package job. That was the CI-only option from the #1580 discussion.

Governing Spec

  • 138-governed-exact-model-execution
  • 068-public-platform-embedder-packages
  • 004-spec-alignment-gate
  • 065-sigstore-bundle-verification

068 covers the public Kotlin package build (build.gradle.kts) and the Maven publish workflow. 004 covers the approved-specs.json governs additions and the CI scripts. 065 covers spec-alignment-gate coverage of docs/releases/next.md.

Project Item

Closes #1580 (slice 3/3; slices 1–2 were #1613 and #1614). Emulator instrumented tests remain #1611.

Validation

  • Gradle wiring, checked locally with placeholder libraries in build/jniLibs: gradle :traverse-embedder:assembleRelease packs jni/arm64-v8a/… and jni/x86_64/…, and android_aar_check.sh passes. With one ABI removed, it fails with missing jni/x86_64/libtraverse_android_host.so.
  • bash -n on both scripts; both workflows parse as YAML; the release naming check passes.
  • The real cross-build, export and alignment checks run in this PR's android-native-package job.

🤖 Generated with Claude Code

… AAR (Decision 108, slice 3)

- scripts/build_android_host_ndk.sh: cargo-ndk cross-build at API 28 with
  16 KB page alignment; checks each .so exports exactly the audited JNI
  method and every LOAD segment is 16 KB aligned
- Gradle packages build/jniLibs into the AAR (no committed binaries)
- scripts/ci/android_aar_check.sh: the release AAR must carry both ABIs
- CI job android-native-package runs the cross-build + AAR check on every
  full-CI PR; the Maven publish job cross-builds and verifies before
  publishing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@enricopiovesan
enricopiovesan enabled auto-merge (squash) October 2, 2026 20:40
@enricopiovesan
enricopiovesan enabled auto-merge (squash) October 2, 2026 20:47
@enricopiovesan
enricopiovesan merged commit 49176e9 into main Oct 2, 2026
40 checks passed
@enricopiovesan
enricopiovesan deleted the claude/issue-1580-android-aar branch October 2, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kotlin embedder: signed exact-ref model execution (Spec 138 parity)

1 participant