Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any proguard rules should use while using EncryptedSharedPreferences?

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.

like image 998
Ahmed Mousa Avatar asked Apr 22 '20 15:04

Ahmed Mousa


People also ask

Where do you put ProGuard rules?

When you create a new project or module using Android Studio, the IDE creates a <module-dir>/proguard-rules.pro file for you to include your own rules. You can also include additional rules from other files by adding them to the proguardFiles property in your module's build.gradle file.

What does EncryptedSharedPreferences encrypt when saving key value pairs?

Using EncryptedSharedPreferences The data stores in the form of key-value pairs. JetSec provides an encrypted version of SharedPreferences , named EncryptedSharedPreferences , that provides strong security while maintaining performance for reading the key-value data. Keys and values can both be encrypted.

What are ProGuard rules?

ProGuard is a free Java app for Android that allows us to do the following: Reduce (minimize) the code: Unused code in the project should be removed. Code obfuscation: Rename the names of classes, fields, and so on. Improve the code: Inline the functions, for example.


1 Answers

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

like image 173
kollesnica power Avatar answered Sep 28 '22 06:09

kollesnica power