Closed cf256 closed 1 year ago
Hi,
We will look into it and get back to you.
Thanks
Hi @cf256
You can keep using the proguard rules which is working for you for now. We will update our proguard rules on our side in the next release. Hope that helps you.
Hi @cf256
I was trying but I'm not able to reproduce the issue.
android.enableR8.fullMode=true
in sample app's gradle.properties
release
variant of the appHi! I've made a sample repo here (https://github.com/cf256/NetsSDKProguardBug) that reproduces it.
Weirdly I'm only able to reproduce it on Android 13.
I was also checking on Android 13 but the issue was not reproducible. Anyways, I'll have a look at that project that you have shared and I'll update you.
I get it now why it was working for me and crashing for you @cf256 because you have optimization step enabled in minifcation process but I didn't.
I have this in sample app proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
and you have this proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
I have noted down the proguard rule changes we need to do. One last thing can you please check if writing these rules work for you. Remove rules which you have previously written for Pia SDK. I'll ship these rules in consumer-rules.pro
in next release
-keep public class eu.nets.pia.PiaSDK { public *;}
-keep public class eu.nets.pia.PiaInterfaceConfiguration { public *;}
-keep public interface eu.nets.pia.RegisterPaymentHandler {*;}
-keep public class eu.nets.pia.data.exception.* {*;}
-keep public class eu.nets.pia.data.model.* {*;}
-keep public class eu.nets.pia.network.model.* {*;}
-keep public class eu.nets.pia.utils.FileLogger {*;}
-keep public class eu.nets.pia.utils.LogUtils {*;}
-keep public class eu.nets.pia.utils.StringUtils {*;}
-keep public class eu.nets.pia.wallets.* {*;}
-keep public class eu.nets.pia.ui.themes.* {*;}
-keep public class eu.nets.pia.ExtensionsKt { *;}
-keep public class eu.nets.pia.card.* {*;}
-keep class **.*$HTMLInterceptor{*;}
-keepclassmembers class eu.nets.pia.ui.main.PiaActivity {
public final static java.lang.String BUNDLE_MERCHANT_INFO;
public final static java.lang.String BUNDLE_TOKEN_CARD_INFO;
public final static java.lang.String BUNDLE_ORDER_INFO;
public final static java.lang.String BUNDLE_COMPLETE_RESULT;
public final static java.lang.String BUNDLE_TRANSACTION_INFO;
}
#Rules required by Card.Io library
-keep class eu.nets.pia.cardio.** { *; }
-dontwarn eu.nets.pia.cardio.**
-keepattributes JavascriptInterface
##---------------Begin: proguard configuration for Retrofit ----------
# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}
# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>
# Keep inherited services.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface * extends <1>
# R8 full mode strips generic signatures from return types if̄ not kept.
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
# With R8 full mode generic signatures are stripped for classes that are not kept.
-keep,allowobfuscation,allowshrinking class retrofit2.Response
##---------------End: proguard configuration for Retrofit ----------
Hi. I've tested those rules in my sample app and it works with those enabled. Thanks!
Great. We will make a release soon. Either this or the next week.
Hi @cf256
We have just published a new version of our SDK. Could you please check and confirm whether the issue has been resolved for you?
Hi. I've tested this now and it works. Thanks
How to reproduce:
android.enableR8.fullMode=true
)Manually setting
android.enableR8.fullMode=false
the crash doesn't happen.Android Studio Flamingo is shipping with this R8.fullMode enabled by default now so I'm guessing this will happen to more and more apps.
I can also resolve this by adding:
to the proguard file. But I'm not sure if this is "keeping" too much.
Stacktrace