codelab-android-datastore icon indicating copy to clipboard operation
codelab-android-datastore copied to clipboard

Use "androidx.datastore:datastore" instead of datastore-core

Open Farbklex opened this issue 3 years ago • 2 comments

On page 5, the codelab instructs you to add the following dependencies:

dependencies {
    implementation  "androidx.datastore:datastore-core:1.0.0"
    implementation  "com.google.protobuf:protobuf-javalite:3.18.0"
    ...
}

On page 7, the codelab instructs to create a DataStore by using the by dataStore delegate:

private val Context.userPreferencesStore: DataStore<UserPreferences> by dataStore(
...

by dataStore is part of a different library. androidx.datastore:datastore:1.0.0. The instructions on page 5 need to be updated to import datastore instead of datastore-core.

The proto_datastore branch already includes the correct dependency.

Farbklex avatar Nov 10 '21 14:11 Farbklex

See the StackOverflow issue related to this problem and codelab for reference

Farbklex avatar Nov 10 '21 14:11 Farbklex

Faced this issue, please add this resolution to documentation

purushottamyadavbattula avatar Mar 20 '22 09:03 purushottamyadavbattula

Duplicate of #27

mmoczkowski avatar Sep 09 '22 20:09 mmoczkowski