0

I am new in proguard and shrink code and resource. I have some problems in this topic and searched but can't find any resources. I want to add proguard to my application then i added below code to my gradle. In my application, i have a login page that get username and password and sent to server with gson and JsonObject. after add proguard, i can't connect to server and failed without any errors. what? What is my problem? I check the value returns from server in debug mode, shows, a.b.c.d , i think that convert to obfuscation class but not recognized.

my gradle:

 buildTypes{
   /* release{
        minifyEnabled true
        shrinkResources true
       *//* proguardFiles getIsDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'*//*
    }*/
    debug{
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile(
                'proguard-android-optimize.txt'),
                'proguard.cfg'
    }
}

I add some parts to proguard configs, because before i had some errors. The proguard.cfg:

-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
  ##---------------Begin: proguard configuration for Gson  ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
 # For using GSON @Expose annotation
-keepattributes *Annotation*
 # Gson specific classes
 -keep class sun.misc.Unsafe { *; }
 #-keep class com.google.gson.stream.** { *; }
 # Application classes that will be serialized/deserialized over Gson
 -keep class com.google.gson.examples.android.model.** { *; }
 ##---------------End: proguard configuration for Gson  ----------
Fahim
  • 384
  • 5
  • 20

3 Answers3

1

try to >> -Keep public com.test.LoginParam

Rahul Patil
  • 129
  • 1
  • 5
0

try-->-keep class com.google.android.gms.internal.** { *; }

  • Thanks for your reply but not changed anything. The service again failed after add this. – Fahim Nov 23 '19 at 13:41
0

you must prevent your model class use in login method to being obfuscate -keep class your model_class_with_package_name.** { *; }