Skip to content

Remove unused androidx.lifecycle dependency#64

Merged
horgh merged 2 commits into
mainfrom
greg/stf-1158-remove-unused-androidxlifecycle-dependency-from-device-sdk
Jul 24, 2026
Merged

Remove unused androidx.lifecycle dependency#64
horgh merged 2 commits into
mainfrom
greg/stf-1158-remove-unused-androidxlifecycle-dependency-from-device-sdk

Conversation

@oschwald

@oschwald oschwald commented Jul 24, 2026

Copy link
Copy Markdown
Member

Fixes #63. Linear: STF-1158

Summary

device-sdk has depended on androidx.lifecycle:lifecycle-runtime-ktx since the initial project skeleton, but no SDK code has ever used a lifecycle API (the SDK manages its own coroutine scope via SupervisorJob + Dispatchers.IO). The dependency was exported in the published POM, and after 0.3.0 bumped it to 2.11.0, androidx version alignment forced consumers with any androidx.lifecycle Compose artifacts on their classpath up to 2.11.0 — whose Compose artifacts require compileSdk 37 / AGP 9.2+ per the androidx Lifecycle release notes.

This removes the dependency from device-sdk and adds a changelog entry for a 0.3.1 patch release. The version catalog entry stays because the sample app uses lifecycleScope and declares its own dependency.

Follow-up: other unused dependencies

A broader audit of declared vs. actually-used dependencies (second commit) also removes:

  • device-sdk: kotlinx-coroutines-android (only Dispatchers.IO is used; the artifact exists to provide Dispatchers.Main), and the unused junit 4 and turbine test dependencies. CLAUDE.md's stale claim that Turbine is used is corrected.
  • sample: unused core-ktx, plus junit / androidx.test.ext:junit test dependencies with no test sources to serve.
  • version catalog: the never-referenced kotlin-reflect entry and the orphaned junit / turbine entries.

None of these change SDK behavior; the only consumer-visible effect is a slimmer POM.

Verification

  • ./gradlew :device-sdk:build (unit tests, detekt, ktlint) passes
  • ./gradlew :sample:assembleDebug passes
  • ./gradlew :device-sdk:japicmp against the released 0.3.0 AAR passes (ABI no-op)
  • :device-sdk:dependencies shows remaining transitive lifecycle constraints (via androidx.core) at 2.6.2, so no compileSdk 37 pressure on consumers

🤖 Generated with Claude Code

The lifecycle-runtime-ktx dependency was added in the initial project
skeleton and has never been used by any SDK code. Exporting it in the
POM at version 2.11.0 forced consumers with androidx.lifecycle Compose
artifacts on their classpath up to 2.11.0 via androidx version
alignment, which requires compileSdk 37 and AGP 9.2+.

The sample app keeps its own lifecycle-runtime-ktx dependency for
lifecycleScope, so the version catalog entry remains.

Fixes GitHub issue #63.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@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: 25 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: 9932202b-1026-43e7-a4d9-91634f8a2cdb

📥 Commits

Reviewing files that changed from the base of the PR and between 04781d6 and 4522b4f.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • CLAUDE.md
  • device-sdk/build.gradle.kts
  • gradle/libs.versions.toml
  • sample/build.gradle.kts
📝 Walkthrough

Walkthrough

The SDK no longer declares the unused AndroidX Lifecycle runtime KTX dependency. A new 0.3.1 (TBD) changelog entry documents its removal and the associated Android toolchain constraints.

Changes

Lifecycle dependency removal

Layer / File(s) Summary
Remove lifecycle dependency and document release
device-sdk/build.gradle.kts, CHANGELOG.md
Removes androidx.lifecycle:lifecycle-runtime-ktx and records the dependency’s previous toolchain impact in the changelog.

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

Possibly related PRs

Poem

A bunny trims a dependency line,
While release notes neatly shine.
No lifecycle KTX in the nest,
Toolchains breathe and builds can rest.
Hop, hop—0.3.1 is blessed!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Removing the unused lifecycle dependency from device-sdk addresses issue #63 by avoiding the transitive version alignment that forced newer toolchain requirements.
Out of Scope Changes check ✅ Passed The only added change beyond the dependency removal is a related changelog entry, which is in scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing an unused androidx.lifecycle dependency.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch greg/stf-1158-remove-unused-androidxlifecycle-dependency-from-device-sdk

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.

An audit of declared dependencies against actual usage found:

- device-sdk: kotlinx-coroutines-android (only Dispatchers.IO is used),
  junit 4, and turbine were never referenced by any source file. The
  CLAUDE.md testing notes incorrectly claimed Turbine was in use.
- sample: core-ktx is not used, and the junit / androidx.test.ext:junit
  test dependencies had no test sources to serve.
- version catalog: kotlin-reflect was defined but referenced by no build
  file; the junit and turbine entries are orphaned by the above.

Verified with :device-sdk:build (tests, detekt, ktlint) and
:sample:assembleDebug.

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

Copilot AI 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.

Pull request overview

This PR trims unused dependencies from the Android SDK and related modules to avoid exporting unnecessary constraints in the published device-sdk POM—specifically removing the unused androidx.lifecycle:lifecycle-runtime-ktx dependency that caused AndroidX lifecycle version alignment issues for consumers.

Changes:

  • Removed unused runtime dependencies from device-sdk (lifecycle-runtime-ktx, kotlinx-coroutines-android) to slim the published dependency graph.
  • Removed unused/testing-only dependencies and catalog entries (junit 4, turbine, kotlin-reflect) and updated the testing bundle accordingly.
  • Added a 0.3.1 changelog entry and updated internal contributor docs (CLAUDE.md) to reflect current test tooling.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sample/build.gradle.kts Removes unused sample app dependencies (core-ktx, test deps).
gradle/libs.versions.toml Removes unused catalog versions/libs and updates the testing bundle.
device-sdk/build.gradle.kts Removes unused device-sdk runtime deps to reduce exported POM constraints.
CLAUDE.md Updates documentation to remove the claim that Turbine is used.
CHANGELOG.md Adds 0.3.1 entry documenting the dependency removals and consumer impact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.md
@@ -1,5 +1,17 @@
# Changelog

## 0.3.1 (TBD)
@horgh
horgh merged commit b977ee0 into main Jul 24, 2026
12 checks passed
@horgh
horgh deleted the greg/stf-1158-remove-unused-androidxlifecycle-dependency-from-device-sdk branch July 24, 2026 16:56
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.

v0.3.0 bumps androidx.lifecycle to 2.11.0, forcing consumers onto compileSdk 37 / newer AGP (regression vs 0.2.0)

3 participants