Is there any proguard rules should use while using EncryptedSharedPreferences?
Asked Answered
G

3

11

before using EncryptedSharedPreferences my app works fine in release mode with (minifyEnabled = true), After adding the security library (version 1.0.0-rc01) to my application the app crash while opening and if i use (minifyEnabled = false) the app works fine, i think i missing something to add it in proguard-rules.pro but i have searched a lot did not found anything.

Gilmour answered 22/4, 2020 at 15:49 Comment(1)
this issue is reported too in issuetracker issuetracker.google.com/issues/154315507Gilmour
F
22

Looks like something wrong with Tink obfuscation. My current workaround is add this rule to proguard:

-keep class com.google.crypto.tink.** { *; }

But also keep track of updates of issue here.

UPDATE - 06.01.2020

There is more effective solution (thanks @jtsalva to pointing out):

-keepclassmembers class * extends com.google.crypto.tink.shaded.protobuf.GeneratedMessageLite {
  <fields>;
}

UPDATE - 08.19.2020

This issue should now fixed in Version 1.0.0-rc03

Fertile answered 28/4, 2020 at 16:34 Comment(1)
This seems to be the more up to date version -keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite { <fields>; }Reata
M
7

This issue has been answered with a more targeted proguard rule here

-keepclassmembers class * extends com.google.crypto.tink.shaded.protobuf.GeneratedMessageLite {
    <fields>;
}

This saves my app ~0.2MB compared to the currently accepted answer

Malinowski answered 31/5, 2020 at 2:22 Comment(0)
S
0

i try all above . not working for my case. this what i do and work perfect:

-keepclassmembers class * extends com.google** {
    <fields>; }
Shipboard answered 9/7, 2020 at 21:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.