Fixed
Status Update
Comments
[Deleted User] <[Deleted User]> #2
I encountered the same error (using full mode R8).
Anyone has the correct rules as a workaround until the next version is released?
Anyone has the correct rules as a workaround until the next version is released?
[Deleted User] <[Deleted User]> #3
Following R8 rules when using DataStore with Preferences are working okay for me:
-keepclassmembers class androidx.datastore.preferences.PreferencesProto$PreferenceMap {
private androidx.datastore.preferences.protobuf.MapFieldLite preferences_;
}
-keepclassmembers class androidx.datastore.preferences.PreferencesProto$Value {
private java.lang.Object value_;
private int valueCase_;
}
-keepclassmembers class androidx.datastore.preferences.PreferencesProto$PreferenceMap {
private androidx.datastore.preferences.protobuf.MapFieldLite preferences_;
}
-keepclassmembers class androidx.datastore.preferences.PreferencesProto$Value {
private java.lang.Object value_;
private int valueCase_;
}
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit ba352589a039f23c1450755ca3a76a50b9722e69
Author: rohitsat13 <rohitsat@google.com>
Date: Mon Sep 21 16:15:24 2020
Fix the crash with DataStore R8. I think this is happening because protobuf-lite uses reflection and r8 thinks the fields are unused.
Test: I added minifyEnabled to the sample app, and it crashes without this change, but it works fine with this change. I also did the same with the preferences datastore codelab
Bug: 168580258
Relnote: Fixing a bug that would cause the app to crash on start up
Change-Id: I69237e3036c4863c3aa011cd88f363441ae5999f
M datastore/datastore-preferences/build.gradle
A datastore/datastore-preferences/proguard-rules.pro
M datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/PreferencesDataStoreActivity.kt
https://android-review.googlesource.com/1433465
Branch: androidx-master-dev
commit ba352589a039f23c1450755ca3a76a50b9722e69
Author: rohitsat13 <rohitsat@google.com>
Date: Mon Sep 21 16:15:24 2020
Fix the crash with DataStore R8. I think this is happening because protobuf-lite uses reflection and r8 thinks the fields are unused.
Test: I added minifyEnabled to the sample app, and it crashes without this change, but it works fine with this change. I also did the same with the preferences datastore codelab
Bug: 168580258
Relnote: Fixing a bug that would cause the app to crash on start up
Change-Id: I69237e3036c4863c3aa011cd88f363441ae5999f
M datastore/datastore-preferences/build.gradle
A datastore/datastore-preferences/proguard-rules.pro
M datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/PreferencesDataStoreActivity.kt
ro...@google.com <ro...@google.com> #5
This will be fixed in the next release.
Description
DataStore Component used: preferences,protostore DataStore Version used: 1.0.0-alpha01 Devices/Android versions reproduced on: All version
Use data store and setup r8, with no rules. App crashes with