My app is not obfuscated due to -dontoptimize and -dontobfuscate rules in

Using the following configuration

-keepattributes SourceFile,LineNumberTable -keep class org.whispersystems.** { *; } 
-keep class org.thoughtcrime.securesms.** { *; } 
-keepclassmembers class ** { public void onEvent*(**); }

after adding the above lines of code, my whole app code is not getting obfuscated now because of just these two lines


If I remove these two configuration options my app crashes during serialization of signal protocol classes.

my configuration in build.gradle file

release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile( proguard-android-optimize.txt'), '', 'proguard.cfg' useProguard true debuggable false } debug { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile( 'proguard-android-optimize.txt'), '', 'proguard.cfg' useProguard true debuggable false }

I tried adding rules for signal in separate file proguard.cfg , as you can see above. but no luck :frowning:
kindly let me know how to obfuscate my app.

1 Like

Hi Naveedcs,

ProGuard’s name obfuscation can make your application crash where it relies on reflection, therefore you will need to create -keep options to preserve those parts of code. In serialized classes you will need to preserve the names of the fields, that will make sure the keys in the serialized data will not contain obfuscated names. You can preserve the field names with a -keep rule as follows;

-keepclassmembers class com.example.MyData {

We documented the frequently occurring exceptions caused by ProGuard together with some information on how to tackle these in our troubleshooting guide, here:

Best regards,


1 Like