Skip to content

Remove androidx.core:core-ktx and prepare 0.3.1 release#65

Merged
horgh merged 4 commits into
mainfrom
greg/stf-1165
Jul 24, 2026
Merged

Remove androidx.core:core-ktx and prepare 0.3.1 release#65
horgh merged 4 commits into
mainfrom
greg/stf-1165

Conversation

@oschwald

@oschwald oschwald commented Jul 24, 2026

Copy link
Copy Markdown
Member

Linear: STF-1165

Summary

Pre-release work for 0.3.1 that ./dev-bin/release.sh does not handle itself. Three self-contained commits:

  1. Remove androidx.core:core-ktx — the SDK's last androidx dependency.
  2. Bump the copyright year to 2026 (README.dev.md step 6; the script only rewrites the version string).
  3. Set the 0.3.1 release date in CHANGELOG.md — the script parses this heading and hard-fails unless the date is today.

Why remove core-ktx

#63 is already fixed by the androidx.lifecycle removal in #64: the reporter was on compileSdk 36 / AGP 8.13.1, and 2.11.0 forced them to 37. What remained was latent rather than live — core-ktx 1.18.0 declares minCompileSdk=36 / minAndroidGradlePluginVersion=8.9.1 in its AAR metadata, which is at or below what the reporter runs and identical to the floor 0.2.0 already shipped via 1.17.0.

The problem is recurrence. The queued 1.19.0 bump (#56) declares 37 / 9.1.0 — the same consumer break as #63, arriving through a different androidx artifact. Rather than re-litigating that on every core-ktx release, this drops the dependency entirely. Its only use was the inline SharedPreferences.edit {} extension, which compiles to exactly edit() / mutate / apply(), so it was replaced with the equivalent framework calls. The published POM now exports no androidx artifact at all, so the SDK is out of androidx version alignment and imposes no compileSdk or AGP floor on consumers.

StoredIDStorageTest already mocked the raw framework calls and asserted apply(), so it passes unchanged — no test edits were needed.

#56 has been closed as moot. #59 (AGP 9.3.0) is deliberately still open: it needs a Gradle wrapper bump to 9.5.0+ first and warrants its own evaluation after this release.

Verification

  • ./gradlew :device-sdk:build — 328 tests, 0 failures; StoredIDStorageTest 6/6 unchanged in both debug and release variants
  • ./gradlew detekt ktlintCheck — pass (note these are not wired into check, so build alone does not run them)
  • ./gradlew :sample:assembleDebug — pass
  • ./gradlew :device-sdk:dependencies --configuration releaseRuntimeClasspath — no androidx entries; the shipped graph is kotlin-stdlib, coroutines-core, serialization-json and the five ktor modules
  • Android Lint reports no UseKtx finding against the rewritten calls

Before merging

Per README.dev.md, run ./dev-bin/release.sh on this branch first — it appends a "Preparing for 0.3.1" commit and pushes, which will land in this PR. If the release slips past 2026-07-24, amend the release-date commit first or the script will refuse to run.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Compatibility

    • Removed reliance on AndroidX Core, reducing platform and version-alignment constraints for integrations.
    • Existing stored identifiers continue to be saved and cleared reliably.
  • Documentation

    • Updated the changelog with the 0.3.1 release date and compatibility notes.
    • Updated copyright notices from 2025 to 2026.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@oschwald, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d7b6fd90-8ec5-426e-b8f3-11636d5280a7

📥 Commits

Reviewing files that changed from the base of the PR and between 5c1e07a and ee20e53.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • README.md
  • build.gradle.kts
  • device-sdk/build.gradle.kts
  • device-sdk/src/main/java/com/maxmind/device/storage/StoredIDStorage.kt
  • gradle/libs.versions.toml
📝 Walkthrough

Walkthrough

The PR removes AndroidX Core KTX, replaces its SharedPreferences.edit {} usage with framework editor calls, removes related version-catalog entries, and updates release and copyright metadata.

Changes

AndroidX Core KTX removal

Layer / File(s) Summary
Replace SharedPreferences extensions and remove dependency
device-sdk/src/main/java/.../StoredIDStorage.kt, device-sdk/build.gradle.kts, gradle/libs.versions.toml
StoredIDStorage uses explicit editor operations, and AndroidX Core KTX dependency and version-catalog entries are removed.
Update release and copyright metadata
CHANGELOG.md, README.md
The 0.3.1 release is dated 2026-07-24, its dependency removal is documented, and copyright notices are updated to 2026.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit with a tidy little nest,
AndroidX hops away at my request.
Preferences write with framework flair,
A fresh release date blooms there,
And 2026 shines everywhere.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing androidx.core:core-ktx and preparing the 0.3.1 release.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch greg/stf-1165

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Around line 14-19: Update the changelog entry near the removed core-ktx
dependency to limit the AndroidX claim to SDK implementation/runtime
dependencies, since device-sdk/build.gradle.kts still declares AndroidX test
dependencies and uses the AndroidX runner. Preserve the dependency-removal and
compileSdk/AGP details while removing or revising the assertion that the SDK has
no AndroidX dependencies.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7fdb3184-7a75-4bfc-949f-372b7e20cf35

📥 Commits

Reviewing files that changed from the base of the PR and between 3069239 and 5c1e07a.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • README.md
  • device-sdk/build.gradle.kts
  • device-sdk/src/main/java/com/maxmind/device/storage/StoredIDStorage.kt
  • gradle/libs.versions.toml
💤 Files with no reviewable changes (2)
  • gradle/libs.versions.toml
  • device-sdk/build.gradle.kts

Comment thread CHANGELOG.md Outdated
Comment on lines +14 to +19
- Removed the `androidx.core:core-ktx` dependency. Its only use was the
`SharedPreferences.edit {}` extension, which has been replaced with the
equivalent framework calls. The SDK now has no `androidx` dependencies at all,
so it no longer participates in androidx version alignment and imposes no
`compileSdk` or Android Gradle Plugin floor on consumers. Previously
`core-ktx` 1.18.0 required `compileSdk` 36 and AGP 8.9.1.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files:"
git ls-files | rg '(^|/)CHANGELOG\.md$|build\.gradle\.kts$|settings\.gradle\.kts$' || true

echo
echo "CHANGELOG snippet:"
if [ -f CHANGELOG.md ]; then sed -n '1,40p' CHANGELOG.md | cat -n; fi

echo
echo "Gradle AndroidX dependency references:"
rg -n --hidden -S "androidx\.|androidx" -g 'build.gradle.kts' -g 'settings.gradle.kts' . || true

echo
echo "device-sdk build.gradle.kts relevant deps:"
if [ -f device-sdk/build.gradle.kts ]; then sed -n '1,220p' device-sdk/build.gradle.kts | cat -n; fi

Repository: maxmind/device-android

Length of output: 11753


Narrow the AndroidX dependency claim in the changelog.

device-sdk/build.gradle.kts still declares AndroidX dependencies for androidTestImplementation (androidx.test.junit and androidx.test.core) and uses the AndroidX runner. Say the SDK’s implementation/runtime dependencies no longer include AndroidX, or remove the remaining AndroidX test dependencies if that is the intended scope.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CHANGELOG.md` around lines 14 - 19, Update the changelog entry near the
removed core-ktx dependency to limit the AndroidX claim to SDK
implementation/runtime dependencies, since device-sdk/build.gradle.kts still
declares AndroidX test dependencies and uses the AndroidX runner. Preserve the
dependency-removal and compileSdk/AGP details while removing or revising the
assertion that the SDK has no AndroidX dependencies.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Taken, with a scoping fix rather than removing the claim — the wording was imprecise, though the consumer-facing substance was already correct.

You're right that device-sdk still declares AndroidX: testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" plus androidTestImplementation on androidx.test.ext:junit and androidx.test:core. So "the SDK now has no androidx dependencies at all" was wrong read as a statement about the Gradle module.

It was not wrong about what consumers inherit. Those are test-only configurations and are not published — the released 0.3.0 POM contains no test dependencies at all, only the runtime set (kotlin-stdlib, coroutines-core, serialization-json, core-ktx, and the five ktor modules). So the version-alignment and compileSdk/AGP-floor claims hold as written; only the scope of the "no androidx" sentence was too broad.

Changed to:

The published artifact now has no androidx dependencies, so it no longer participates in androidx version alignment and imposes no compileSdk or Android Gradle Plugin floor on consumers.

That is the claim consumers care about, and it is verifiable: :device-sdk:dependencies --configuration releaseRuntimeClasspath now returns zero androidx entries.

Squashed into the original commit (e1fcf5f) rather than left as a separate fixup, since this branch hasn't had human review yet.

— Claude, on behalf of @oschwald

oschwald and others added 3 commits July 24, 2026 20:03
The SDK's only androidx usage was the SharedPreferences.edit {} extension
in StoredIDStorage. That extension is inline and compiles to exactly
edit() / mutate / apply(), so calling the framework methods directly is
behaviorally identical. StoredIDStorageTest already mocked the raw
framework calls and asserted apply(), so it passes unchanged.

Removing it means the published POM no longer exports any androidx
artifact, so the SDK is out of androidx version alignment entirely and
imposes no compileSdk or AGP floor on consumers. core-ktx 1.18.0
declared minCompileSdk 36 / minAndroidGradlePluginVersion 8.9.1, and the
queued 1.19.0 bump declares 37 / 9.1.0 -- the same shape of consumer
breakage reported in GitHub #63. This removes that class of problem
rather than re-evaluating it on each core-ktx release.

Verified with :device-sdk:build (328 tests, lint), detekt, ktlintCheck,
and :sample:assembleDebug. releaseRuntimeClasspath now contains no
androidx entries.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The project's first release was in 2025 and it is still being changed in
2026, so a range rather than a single year.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
horgh
horgh previously approved these changes Jul 24, 2026
@horgh
horgh merged commit ffe781c into main Jul 24, 2026
12 of 13 checks passed
@horgh
horgh deleted the greg/stf-1165 branch July 24, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants