Skip to content

arch: split :common:android from :common#20731

Merged
mikehardy merged 6 commits intoankidroid:mainfrom
david-allison:common-android
Apr 19, 2026
Merged

arch: split :common:android from :common#20731
mikehardy merged 6 commits intoankidroid:mainfrom
david-allison:common-android

Conversation

@david-allison
Copy link
Copy Markdown
Member

@david-allison david-allison commented Apr 13, 2026

Note

Assisted-by Claude Opus 4.6 (Max Effort)
the initial move was performed and the dependencies were added
But, most were incorrect, so there was a lot of manual fixups

Purpose / Description

I want libanki to become a java-library. Since it depends on :common, :common also needs to be a Java library

Approach

  • prep for splitting out common:android:
    • Move to SLF4J, to remove the android dependency
      • We already have transitive dependencies on this, and Timber works out-the-box
    • Fixup a hack regarding opt-in jvm flags
    • Fixup test dependencies to switch Android calls with JVM calls
  • Then split out the module

How Has This Been Tested?

app still runs as expected.

Learning (optional, can help others)

I've seen a lot about SLF4J , but never used it. Very easy!

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

`:common` will be moved to a `java-library`. SLF4J is bridged to Timber
via slf4j-timber in the app, so logs will continue to work.

Due to this, fewer classes will need to move to `:common:android`

Using 1.7.30 as this is the current transitive dependency

Assisted-by: Claude Opus 4.6
It's better to remove the opt-in flag, rather than add the library
We want to move Android dependencies to ':common:android', these files
 can remain in a `jvm-library` if we fixup a few annotations

Related to https://redirect.github.com/ankidroid/Anki-Android-Backend/issues/674
In preparation for moving libanki to be pure JVM, we need :common to be
a java-library.

JSON is supported by both android and JVM (with slightly differing apis
so it can remain in `:common`

Assisted-by: Claude Opus 4.6

Related to https://redirect.github.com/ankidroid/Anki-Android-Backend/issues/674
`com.ichi2.anki.utils.android` should be
`com.ichi2.anki.common.utils.android`
Otherwise it's easy to forget to add it to androidModulesToUnitTest

Assisted-by: Claude Opus 4.6 - tests
@criticalAY criticalAY added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Apr 18, 2026
Copy link
Copy Markdown
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

LGTM - carefully changing the engines on the plane while it's aloft, nice

Related - purge the boilerplate out of the new build gradle file in an on-deck-but-next-version PR that also LGTM:

@mikehardy mikehardy added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Apr 19, 2026
@mikehardy mikehardy added this pull request to the merge queue Apr 19, 2026
Merged via the queue into ankidroid:main with commit cc07e9f Apr 19, 2026
15 checks passed
@github-actions github-actions bot added this to the 2.24 release milestone Apr 19, 2026
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Apr 19, 2026
@david-allison david-allison deleted the common-android branch April 20, 2026 09:46
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.

3 participants