Skip to content

fix(deps): update android datastore dependencies for platform support#161

Closed
ArthurKun21 wants to merge 1 commit into
masterfrom
fix/gradle/use-android-datastore-for-android
Closed

fix(deps): update android datastore dependencies for platform support#161
ArthurKun21 wants to merge 1 commit into
masterfrom
fix/gradle/use-android-datastore-for-android

Conversation

@ArthurKun21

Copy link
Copy Markdown
Owner

New Pull Request

Pull Request Type

  • Chore/Refactor
  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

Description

Updated the datastore dependencies to include the android-version while keeping other platform to the core version

Screenshots

Testing

Additional context

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request configures platform-specific Datastore dependencies for the generic-datastore-preferences and generic-datastore-proto modules, introducing target-specific dependencies for Android, JVM, and iOS. The reviewer recommends keeping the core Datastore dependencies as api in commonMain instead of using compileOnly and duplicating them across JVM and iOS targets, as Gradle's dependency resolution can automatically handle the transitive dependencies on Android.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +22 to +38
compileOnly(libs.datastore.preferences.core)
api(libs.okio)
implementation(libs.kotlinx.io.core)
implementation(libs.kotlinx.serialization.json)
}

androidMain.dependencies {
api(libs.datastore.preferences)
}

jvmMain.dependencies {
api(libs.datastore.preferences.core)
}

iosMain.dependencies {
api(libs.datastore.preferences.core)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using compileOnly in commonMain for datastore.preferences.core is unnecessary and requires duplicating the dependency as api in jvmMain, iosMain, and potentially other targets.

Instead, you can keep api(libs.datastore.preferences.core) in commonMain. Gradle's dependency resolution will automatically handle the dependency on Android when androidMain declares api(libs.datastore.preferences) (since datastore-preferences transitively depends on datastore-preferences-core). This avoids duplicating the dependency for every other target platform and ensures that any future targets added to the project will automatically inherit the core dependency.

            api(libs.datastore.preferences.core)
            api(libs.okio)
            implementation(libs.kotlinx.io.core)
            implementation(libs.kotlinx.serialization.json)
        }

        androidMain.dependencies {
            api(libs.datastore.preferences)
        }

Comment on lines +22 to +39
compileOnly(libs.datastore.core)
api(libs.datastore.core.okio)
api(libs.okio)
implementation(libs.kotlinx.io.core)
implementation(libs.kotlinx.serialization.json)
}

androidMain.dependencies {
api(libs.datastore.android.core)
}

jvmMain.dependencies {
api(libs.datastore.core)
}

iosMain.dependencies {
api(libs.datastore.core)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Similarly, using compileOnly in commonMain for datastore.core is unnecessary and requires duplicating the dependency as api in jvmMain, iosMain, and other targets.

Keeping api(libs.datastore.core) in commonMain allows Gradle to resolve the dependency graph cleanly on Android when androidMain declares api(libs.datastore.android.core) (since androidx.datastore:datastore transitively depends on androidx.datastore:datastore-core). This eliminates the need to manually declare api(libs.datastore.core) in jvmMain and iosMain.

            api(libs.datastore.core)
            api(libs.datastore.core.okio)
            api(libs.okio)
            implementation(libs.kotlinx.io.core)
            implementation(libs.kotlinx.serialization.json)
        }

        androidMain.dependencies {
            api(libs.datastore.android.core)
        }

@ArthurKun21 ArthurKun21 marked this pull request as draft June 5, 2026 14:12
@ArthurKun21 ArthurKun21 closed this Jun 6, 2026
@ArthurKun21 ArthurKun21 deleted the fix/gradle/use-android-datastore-for-android branch June 6, 2026 10:37
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.

1 participant