Android Question Using 3rd party library with AAR file

Mark Ryan Penafiel

Member
Licensed User
Longtime User
I want to use a 3rd party payment library with aar file.

their documentation is

https://t.2c2p.com/Manuals/android/request_nonui/newpayment.html


the AAR file can be found here

https://2c2p-cloudfront.s3-ap-south...demoCode/Mobile/v3/PGW_SDK_ANDROID_v3.9.0.zip

however by just adding the aar code,

#AdditionalJar:
#AdditionalJar: PGW_SDK_ANDROID_v3.9.0.aar
i have this error



cant find a similar error, any idea. Ty
 

DonManfred

Expert
Licensed User
Longtime User
The Library must be Desugared. Just adding them is not enough here. Maybe Jetifying it can work (you need to try).
Jetify:
Desugar:

You need to write a wrapper for this AAR to use which requires some java-knowledge.
Alternatively you can use JAvaObject to work with it. requires some java-knowledge too.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
this may go beyond desugaring. i desugared the .aar and tried to compile the example. none of the errors you reported appeared, BUT a missing resolution of androidx fragment was triggered. when i downloaded that from maven and rebuilt, all the errors you reported came back. some googling indicated that the errors have to do with proguard. when i checked the androidx fragment .aar, it had, in fact, been built with proguard. (your .aar did not use proguard). i don't know what you end up with if you desugar such an .aar. i think this is getting above my pay grade, so i humbly abandon ship at this point. sorry.
 
Last edited:
Upvote 0

Mark Ryan Penafiel

Member
Licensed User
Longtime User
thank you for your response,

in the manual for android studio, it needed to setup a proguard. can be this be also be done in b4a? Thank you

proguard config file:
#Optional for proguard, you may use your own proguard configuration.
    -dontusemixedcaseclassnames
    -dontpreverify
    -optimizationpasses 5
    -keepparameternames
    -renamesourcefileattribute SourceFile

    #Mandatory for PGW SDK
    #2C2P PGW Library
    -dontwarn com.ccpp.my2c2psdk.**
    -keep class com.ccpp.my2c2psdk.** { *; }
    -keep interface com.ccpp.my2c2psdk.** { *; }

    -keepclassmembers class **.R$* {
        public static <fields>;
    }

    #okhttp3
    -dontwarn okio.**
    -keep class okhttp3.** { *; }
    -keep interface okhttp3.** { *; }
    -dontwarn okhttp3.**
    -keepclassmembers class * extends javax.net.ssl.SSLSocketFactory {
        private final javax.net.ssl.SSLSocketFactory delegate;
    }
    -dontwarn javax.annotation.**
    -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
    -dontwarn org.codehaus.mojo.animal_sniffer.*
    -dontwarn okhttp3.internal.platform.ConscryptPlatform

    #Samsung Pay
    -dontwarn com.samsung.**
    -keep class com.samsung.** { *; }

    #Spongy Castle
    -dontwarn org.spongycastle.**
    -keep class org.spongycastle.** { *; }

    #AliPay
    -dontwarn com.alipay.**
    -dontwarn org.json.alipay.**
    -keep class com.alipay.** { *; }
    -keep class org.json.alipay.** { *; }
    -keep class com.alipay.android.app.IAlixPay{*;}
    -keep class com.alipay.android.app.IAlixPay$Stub{*;}
    -keep class com.alipay.android.app.IRemoteServiceCallback{*;}
    -keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;}
    -keep class com.alipay.sdk.app.PayTask{ public *;}
    -keep class com.alipay.sdk.app.AuthTask{ public *;}
    -keep class com.alipay.sdk.app.H5PayCallback {
        <fields>;
        <methods>;
    }
    -keep class com.alipay.android.phone.mrpc.core.** { *; }
    -keep class com.alipay.apmobilesecuritysdk.** { *; }
    -keep class com.alipay.mobile.framework.service.annotation.** { *; }
    -keep class com.alipay.mobilesecuritysdk.face.** { *; }
    -keep class com.alipay.tscenter.biz.rpc.** { *; }
    -keep class org.json.alipay.** { *; }
    -keep class com.alipay.tscenter.** { *; }
    -keep class com.ta.utdid2.** { *;}
    -keep class com.ut.device.** { *;}
    -dontwarn com.ta.utdid2.**
    -dontwarn com.ut.device.**
    -dontwarn com.alipay.mobilesecuritysdk.**
    -dontwarn com.alipay.security.**
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…