fix(deps): update android datastore dependencies for platform support#161
fix(deps): update android datastore dependencies for platform support#161ArthurKun21 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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.
| 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) | ||
| } |
There was a problem hiding this comment.
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)
}| 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) | ||
| } |
There was a problem hiding this comment.
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)
}
New Pull Request
Pull Request Type
Related issue
Description
Updated the datastore dependencies to include the android-version while keeping other platform to the core version
Screenshots
Testing
Additional context