Skip to content

ADFA-4643: Remove com.sun.jna from the APK#1577

Merged
davidschachterADFA merged 2 commits into
stagefrom
fix/ADFA-4643-remove-jna
Jul 25, 2026
Merged

ADFA-4643: Remove com.sun.jna from the APK#1577
davidschachterADFA merged 2 commits into
stagefrom
fix/ADFA-4643-remove-jna

Conversation

@davidschachterADFA

Copy link
Copy Markdown
Collaborator

Summary

  • com.sun.jna isn't a direct dependency — it's pulled in transitively via com.android.tools:common:31.2.2 (depended on as api(libs.aapt2.common) in templates-api and subprojects/aaptcompiler), through jna-platform.
  • The only JNA usage inside common is ComputerArchUtilsKt.computeIsRosetta(), a macOS-only Rosetta/x86-emulation detector gated behind an os.name check that's unreachable on Android (os.name is always "Linux" there) — confirmed by decompiling the class.
  • Excludes net.java.dev.jna on the aapt2-common dependency in both consuming modules, and removes the now-redundant com/sun/jna/** packaging exclude.
  • Saves ~221 kB from the APK per the ticket.

Test plan

  • dependencyInsight confirms net.java.dev.jna is fully gone from :app's runtime classpath
  • compileV8DebugKotlin succeeds for aaptcompiler, templates-api, templates-impl, app
  • Unit tests pass for aaptcompiler and templates-api
  • Full :app:assembleV8Debug succeeds
  • Verified the built APK contains no com/sun/jna classes

🤖 Generated with Claude Code

davidschachterADFA and others added 2 commits July 24, 2026 17:17
com.android.tools:common pulls in net.java.dev.jna transitively via
jna-platform, purely for a macOS-only Rosetta/x86-emulation detector
(ComputerArchUtilsKt.computeIsRosetta()) that's gated behind an
os.name check unreachable on Android. Exclude the jna group where
aapt2-common is depended on to drop it from the APK, and remove the
now-redundant com/sun/jna packaging exclude.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Spotless ratchet pulled in this file's existing 4-space indentation
after ADFA-4643 touched it. Auto-fixed by spotlessApply.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 34ae396f-6c87-4a70-a20b-bd830eac9eeb

📥 Commits

Reviewing files that changed from the base of the PR and between 7242301 and 1f921eb.

📒 Files selected for processing (3)
  • composite-builds/build-logic/plugins/src/main/java/com/itsaky/androidide/plugins/conf/AndroidModuleConf.kt
  • subprojects/aaptcompiler/build.gradle.kts
  • templates-api/build.gradle.kts
💤 Files with no reviewable changes (1)
  • composite-builds/build-logic/plugins/src/main/java/com/itsaky/androidide/plugins/conf/AndroidModuleConf.kt

📝 Walkthrough
  • Excluded the transitive net.java.dev.jna dependency from aapt2-common in templates-api and subprojects/aaptcompiler.
  • Removed the redundant com/sun/jna/** APK packaging exclusion.
  • Expected to reduce APK size by approximately 221 kB.
  • Verified dependency resolution, compilation, unit tests, full APK assembly, and absence of com/sun/jna classes in the APK.
  • No known risks or best-practice violations; the dependency is only used for unreachable macOS Rosetta detection code on Android.

Walkthrough

The change excludes the JNA dependency group from aapt2.common in two modules and removes the matching com/sun/jna/** Android packaging exclusion.

Changes

JNA dependency and packaging alignment

Layer / File(s) Summary
Dependency and packaging updates
subprojects/aaptcompiler/build.gradle.kts, templates-api/build.gradle.kts, composite-builds/.../AndroidModuleConf.kt
The two aapt2.common API dependencies exclude net.java.dev.jna, while Android resource packaging no longer excludes com/sun/jna/**.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A rabbit hops through builds so neat,
Trimming JNA from each receipt.
Resources bloom where exclusions cease,
Gradle paths align in peace.
Hop, hop—clean dependencies!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing com.sun.jna from the APK.
Description check ✅ Passed The description is directly related to the dependency exclusion and APK packaging changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ADFA-4643-remove-jna

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@davidschachterADFA
davidschachterADFA merged commit 7f1ffb3 into stage Jul 25, 2026
4 checks passed
@davidschachterADFA
davidschachterADFA deleted the fix/ADFA-4643-remove-jna branch July 25, 2026 01:05
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.

2 participants