4

I have a payment application with payumoney integration. It was working fine until i added the proguard. Recently I have added Proguard to my build.gradle file (Module: app)

  ` buildTypes {
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config
    }
}` 

After this App gets closed when i proceed to payment. It is working fine when i Changed minifyEnabled to false.

Following is my Module:PayuMoneySdk Build.gradle File

`buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }`

How can I solve this issue? I can't disable proguard.

Can I enable proguard to only Module:app? And will it solve the issue?

I am new to programming. Please help!!

Ankit Kumar
  • 397
  • 2
  • 11
  • 21
Anoop
  • 485
  • 4
  • 15

2 Answers2

2

The solution is to look up for the methods and classess that needs to be exempted and add them to the proguard rules as follows..

-keep class com.mm.** {*;}
-keep class com.company.** {*;}
-keepclassmembers  class com.mm.** {*;}
-keepclassmembers  class com.company.** {*;}
Ashutosh
  • 186
  • 1
  • 8
  • I have 2 proguard.pro files. one for Module:app and another one for Module:PayuMoneySdk. Where i need to write this code? Can i exempt a full module from proguard? – Anoop Nov 17 '17 at 17:16
  • It Worked. Thanks !! – Anoop Nov 18 '17 at 04:27
1
add below lines in proguard-rule.pro file

 -dontwarn okio.**
 # Platform calls Class.forName on types which do not exist on Android to determine platform.
 -dontnote retrofit2.Platform
 # Platform used when running on Java 8 VMs. Will not be used at runtime.
 -dontwarn retrofit2.Platform$Java8
 # Retain generic type information for use by reflection by converters and adapters.
 -keepattributes Signature
 # Retain declared checked exceptions for use by a Proxy instance.
 -keepattributes Exceptions


-keep class com.** { *; }
Gurupreet
  • 39
  • 5