payu-intrepos / payumoney-new-sample-app

New Sample App For PayUmoney and PnP SKD integration
40 stars 37 forks source link

"minifyEnabled true" some error occurred #42

Closed NishiEmed closed 4 years ago

NishiEmed commented 4 years ago

The code is working perfectly with sandbox as well as production environment.

I am getting issue only when I use proguard like minifyEnabled true

I already applied rules in proguard-rules.pro

-dontwarn com.mixpanel.**
-dontwarn org.apache.http.**
-dontwarn com.android.volley.toolbox.**

getting null intent in onActivityResult

It's very much disappointing.

Rahul-Hooda commented 4 years ago

@NishiEmed - Check with below proguard rules -

-keepclassmembers class fqcn.of.javascript.interface.for.webview { public *; }

Uncomment this to preserve the line number information for

debugging stack traces.

-keepattributes SourceFile,LineNumberTable

If you keep the line number information, uncomment this to

hide the original source file name.

-renamesourcefileattribute SourceFile

-keep class com.payumoney.core.entity.PaymentEntity{ ; } -keep class com.payumoney.core.entity.CardDetail{ ; } -keep class com.payumoney.core.entity.EmiTenure{ ; } -keep class com.payumoney.core.entity.EmiThreshold{ ; } -keep class com.payumoney.core.response.UserDetail{ ; } -keep class com.payumoney.core.entity.PayumoneyConvenienceFee{ public ; } -keep class com.payumoney.core.PayUmoneyConstants{ ; } -keep class com.payumoney.core.PayUmoneySDK{ public ; } -keep interface com.payumoney.core.listener.APICallbackListener{ public ; } -keep interface extends com.payumoney.core.listener.APICallbackListener{ public ; } -keep class com.payumoney.core.request.PaymentRequest{ public ; } -keep class com.payumoney.core.response.BinDetail{ public ; } -keep class com.payumoney.core.response.ErrorResponse{ public ; } -keep class com.payumoney.core.response.PaymentOptionDetails{ public ; } -keep class com.payumoney.core.utils.SdkHelper{ public ; } -keep class com.payumoney.core.response.PayUMoneyLoginResponse{ public ; } -keep class com.payumoney.core.response.NetBankingStatusResponse{ public ; } -keep class com.payumoney.core.PayUmoneySdkInitializer{ public static ; } -keep class com.payumoney.core.PayUmoneySdkInitializer$PaymentParam{ ; } -keep class com.payumoney.core.PayUmoneySdkInitializer$PaymentParam$Builder{ ; } -keep class implements android.os.Parcelable { ; } -keep class extends java.lang.Enum { ; } -keep class com.payumoney.core.PayUmoneyConfig{ ; } -keep class com.payumoney.core.utils.SharedPrefsUtils{ ; } -keep class com.payumoney.core.utils.SharedPrefsUtils${ ; } -keep class com.payumoney.core.widget.ExpiryDate{ public ; } -keep class { public ; public static ; }

-dontwarn android.support. -keep class android.support.v4. { *; } -keep interface android.support.v4. { *; } -keep class android.support.v7.* { ; } -keep interface android.support.v7. { *; }

To maintain custom components names that are used on layouts XML:

-keep public class extends android.view.View { public (android.content.Context); public (android.content.Context, android.util.AttributeSet); public (android.content.Context, android.util.AttributeSet, int); public void set(...); }

To keep parcelable classes (to serialize - deserialize objects to sent through Intents)

-keep class implements android.os.Parcelable { public static final android.os.Parcelable$Creator ; }

Core SDK Config starts here....

-keep class com.google.* { ; } -keep class com.zl.reik.* { ; } -keepattributes Annotation ############### END ....###########################

############################# 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 com.google.gson.stream.* { ; } -keep class com.google.* {;}

Application classes that will be serialized/deserialized over Gson

-keep class com.google.gson.examples.android.model.* { ; }

Prevent proguard from stripping interface information from TypeAdapterFactory,

JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)

-keep class implements com.google.gson.TypeAdapterFactory -keep class implements com.google.gson.JsonSerializer -keep class * implements com.google.gson.JsonDeserializer ############################# End: proguard configuration for Gson ############################

Proguard Config for Payumoney Plug & Play SDK START

-keep class android.support.annotation.Keep -keep @android.support.annotation.Keep class -keepclassmembers @android.support.annotation.Keep class {

; } -keep class *{ public ; public static * ; }
NishiEmed commented 4 years ago

Thanks, for your quick reply Rahul-Hooda . It's a bit unclear to understand. could you please share neat code to put in proguard-rules.pro

Rahul-Hooda commented 4 years ago

@NishiEmed - Check below -

-keepclassmembers class fqcn.of.javascript.interface.for.webview { public *; }

-keepattributes SourceFile,LineNumberTable -renamesourcefileattribute SourceFile

-keep class com.payumoney.core.entity.PaymentEntity{ ; } -keep class com.payumoney.core.entity.CardDetail{ ; } -keep class com.payumoney.core.entity.EmiTenure{ ; } -keep class com.payumoney.core.entity.EmiThreshold{ ; } -keep class com.payumoney.core.response.UserDetail{ ; } -keep class com.payumoney.core.entity.PayumoneyConvenienceFee{ public ; } -keep class com.payumoney.core.PayUmoneyConstants{ ; } -keep class com.payumoney.core.PayUmoneySDK{ public ; } -keep interface com.payumoney.core.listener.APICallbackListener{ public ; } -keep interface extends com.payumoney.core.listener.APICallbackListener{ public ; } -keep class com.payumoney.core.request.PaymentRequest{ public ; } -keep class com.payumoney.core.response.BinDetail{ public ; } -keep class com.payumoney.core.response.ErrorResponse{ public ; } -keep class com.payumoney.core.response.PaymentOptionDetails{ public ; } -keep class com.payumoney.core.utils.SdkHelper{ public ; } -keep class com.payumoney.core.response.PayUMoneyLoginResponse{ public ; } -keep class com.payumoney.core.response.NetBankingStatusResponse{ public ; } -keep class com.payumoney.core.PayUmoneySdkInitializer{ public static ; } -keep class com.payumoney.core.PayUmoneySdkInitializer$PaymentParam{ ; } -keep class com.payumoney.core.PayUmoneySdkInitializer$PaymentParam$Builder{ ; } -keep class implements android.os.Parcelable { ; } -keep class extends java.lang.Enum { ; } -keep class com.payumoney.core.PayUmoneyConfig{ ; } -keep class com.payumoney.core.utils.SharedPrefsUtils{ ; } -keep class com.payumoney.core.utils.SharedPrefsUtils${ ; } -keep class com.payumoney.core.widget.ExpiryDate{ public ; } -keep class { public ; public static ; }

-dontwarn android.support. -keep class android.support.v4. { *; } -keep interface android.support.v4. { *; } -keep class android.support.v7.* { ; } -keep interface android.support.v7. { *; }

-keep public class extends android.view.View { public (android.content.Context); public (android.content.Context, android.util.AttributeSet); public (android.content.Context, android.util.AttributeSet, int); public void set(...); }

-keep class implements android.os.Parcelable { public static final android.os.Parcelable$Creator ; }

-keep class com.google.* { ; } -keep class com.zl.reik.* { ; } -keepattributes Annotation

-keepattributes Signature -keepattributes Annotation -keep class com.google.gson.stream. { *; } -keep class com.google.* {;} -keep class com.google.gson.examples.android.model. { ; } -keep class implements com.google.gson.TypeAdapterFactory -keep class implements com.google.gson.JsonSerializer -keep class implements com.google.gson.JsonDeserializer

-keep class android.support.annotation.Keep -keep @android.support.annotation.Keep class -keepclassmembers @android.support.annotation.Keep class {

; } -keep class *{ public ; public static * ; }
NishiEmed commented 4 years ago

Thanks for the reply:

I finally ended up successfully with updating your given rules.

-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}

-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile

# Payumoney start
-dontwarn com.mixpanel.**
-dontwarn org.apache.http.**
-dontwarn com.android.volley.toolbox.**

-keep class com.payumoney.core.entity.PaymentEntity{
*;
}
-keep class com.payumoney.core.entity.CardDetail{
*;
}
-keep class com.payumoney.core.entity.EmiTenure{
*;
}
-keep class com.payumoney.core.entity.EmiThreshold{
*;
}
-keep class com.payumoney.core.response.UserDetail{
*;
}
-keep class com.payumoney.core.entity.PayumoneyConvenienceFee{
    public *;
}
-keep class com.payumoney.core.PayUmoneyConstants{
*;
}
-keep class com.payumoney.core.PayUmoneySDK{
public *;
}
-keep interface com.payumoney.core.listener.APICallbackListener{
public *;
}
-keep interface * extends com.payumoney.core.listener.APICallbackListener{
public *;
}
-keep class com.payumoney.core.request.PaymentRequest{
public *;
}
-keep class com.payumoney.core.response.BinDetail{
public *;
}
-keep class com.payumoney.core.response.ErrorResponse{
public *;
}
-keep class com.payumoney.core.response.PaymentOptionDetails{
public *;
}
-keep class com.payumoney.core.utils.SdkHelper{
public *;
}
-keep class com.payumoney.core.response.PayUMoneyLoginResponse{
public *;
}
-keep class com.payumoney.core.response.NetBankingStatusResponse{
public *;
}
-keep class com.payumoney.core.PayUmoneySdkInitializer{
public static * ;
}
-keep class com.payumoney.core.PayUmoneySdkInitializer$PaymentParam{
*;
}
-keep class com.payumoney.core.PayUmoneySdkInitializer$PaymentParam$Builder{
*;
}
-keep class * implements android.os.Parcelable {
*;
}
-keep class * extends java.lang.Enum {
*;
}
-keep class com.payumoney.core.PayUmoneyConfig{
*;
}
-keep class com.payumoney.core.utils.SharedPrefsUtils{
*;
}
-keep class com.payumoney.core.utils.SharedPrefsUtils${
*;
}
-keep class com.payumoney.core.widget.ExpiryDate{
public *;
}
-keep class *{
public *;
public static * ;
}

-dontwarn android.support.**
-keep class android.support.v4.** { *; }
-keep interface android.support.v4.* { *; }
-keep class android.support.v7.* { *; }
-keep interface android.support.v7.* { *; }

-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

-keep class com.google.** { *; }
-keep class com.zl.reik.* { *; }
-keepattributes Annotation

-keepattributes Signature
-keepattributes Annotation
-keep class com.google.gson.stream.** { *; }
-keep class com.google.* {*;}
-keep class com.google.gson.examples.android.model.** { *; }
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

-keep class android.support.annotation.Keep
-keep @android.support.annotation.Keep class *
-keepclassmembers @android.support.annotation.Keep class * {
*;
}
-keep class *{
public *;
public static * ;
}
# Payumoney end