Skip to content

fix: android consumer-rules - #25

Draft
ovitrif wants to merge 3 commits into
masterfrom
fix/r8-keep-fieldorder
Draft

fix: android consumer-rules#25
ovitrif wants to merge 3 commits into
masterfrom
fix/r8-keep-fieldorder

Conversation

@ovitrif

@ovitrif ovitrif commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Fixes #23

Follow-up to #24.

The Android AAR ships consumer keep rules for UniFFI/JNA so a minified app can resolve JNI names and lay out JNA structs.

Library publish packages proguard.txt in the AAR. Minified-app R8 belongs in the consuming app.

Description

  • Keeps com.sun.jna.* so libjnidispatch can resolve JNI names on Native, Structure, and CallbackReference.
  • Keeps classes that extend com.sun.jna.*, including com.sun.jna.ptr ByReference types used as UniFFI callback out-params.
  • Keeps com.sun.jna.Structure$FieldOrder and annotated com.synonym.vssclient struct classes, fields, and constructors.
  • Fails bundleReleaseAar when the AAR is missing a non-empty proguard.txt.

Out of scope

  • Running R8 in this repo.

Preview

N/A — Android consumer keep rules only.

QA Notes

  • Release AAR contains a non-empty proguard.txt with those consumer keep rules.

R8 full mode stripped @structure.FieldOrder from UniFFI structs. Keep the
annotation type and annotated classes so JNA can still lay out the structs.
@ovitrif
ovitrif requested a review from ben-kaufman August 26, 2026 20:17
@ovitrif
ovitrif marked this pull request as draft August 26, 2026 20:39
@ovitrif ovitrif changed the title fix: keep JNA FieldOrder annotations under R8 fix: keep JNA JNI symbols in Android consumer rules Aug 26, 2026
@ovitrif ovitrif changed the title fix: keep JNA JNI symbols in Android consumer rules fix: android consumer-rules Aug 26, 2026
Ship FieldOrder and com.sun.jna.* keeps in the AAR. Library publish
only checks that proguard.txt is packaged; minified-app R8 belongs in
the consuming app.
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.

add android r8 consumer keep rules

1 participant