无法在 a.a.k@... 上提取信任管理器 - PayPal-Android-SDK 2.13.3

Unable to extract the trust manager on a.a.k@... - PayPal-Android-SDK 2.13.3

我最近将我的 Song Scrapbook 应用程序更新到了最新版本,并确保更新了该应用程序使用的所有第三方 API。一种这样的第三方工具是 PayPal Android SDK,我用它来通过我的应用程序获利,因为我居住的国家/地区目前不支持 Google 电子钱包商户服务 - 这意味着我无法使用 Play在我的应用程序中存储应用程序内或一次性购买系统。

但是,在我的应用程序中(通过 mavenCentral)将 PayPal SDK 更新到最新版本后,每次我想执行 PayPal 交易时,我都会在 Android Studio(版本:1.5.1)中收到以下错误:

    debug W/paypal.sdk: PayPalService created. API:19 PayPalSDK/PayPal-Android-SDK 2.13.3 (Android 4.4.4; samsung GT-I9060I; )
    03-20 16:58:45.540 7804-7804/com.whitsoft.songscrapbook.debug W/ApplicationPackageManager: getCSCPackageItemText()
    03-20 16:58:45.550 7804-7804/com.whitsoft.songscrapbook.debug W/ApplicationPackageManager: getCSCPackageItemText()
    03-20 16:58:45.550 7804-7804/com.whitsoft.songscrapbook.debug I/dalvikvm: Could not find method com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable, referenced from method com.paypal.android.sdk.at.a
    03-20 16:58:45.550 7804-7804/com.whitsoft.songscrapbook.debug W/dalvikvm: VFY: unable to resolve static method 10405: Lcom/google/android/gms/common/GooglePlayServicesUtil;.isGooglePlayServicesAvailable (Landroid/content/Context;)I
    03-20 16:58:45.610 7804-7804/com.whitsoft.songscrapbook.debug I/dalvikvm: Could not find method io.card.payment.CardIOActivity.checkSelfPermission, referenced from method io.card.payment.CardIOActivity.onCreate
    03-20 16:58:45.610 7804-7804/com.whitsoft.songscrapbook.debug W/dalvikvm: VFY: unable to resolve virtual method 13172: Lio/card/payment/CardIOActivity;.checkSelfPermission (Ljava/lang/String;)I
    03-20 16:58:45.820 7804-7843/com.whitsoft.songscrapbook.debug I/System: Loaded time zone names for "en" in 132ms (127ms in ICU)
    03-20 16:58:45.840 7804-7804/com.whitsoft.songscrapbook.debug W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x4168cbc0)
    03-20 16:58:45.840 7804-7804/com.whitsoft.songscrapbook.debug E/AndroidRuntime: FATAL EXCEPTION: main
                                                                            Process: com.whitsoft.songscrapbook.debug, PID: 7804
                                                                            java.lang.RuntimeException: Unable to start service com.paypal.android.sdk.payments.PayPalService@41e9c5a0 with Intent { cmp=com.whitsoft.songscrapbook.debug/com.paypal.android.sdk.payments.PayPalService (has extras) }: java.lang.IllegalStateException: Unable to extract the trust manager on a.a.k@41ff61a0, sslSocketFactory is class com.paypal.android.sdk.bn
                                                                                at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2987)
                                                                                at android.app.ActivityThread.access00(ActivityThread.java:166)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:136)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5584)
                                                                                at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                at java.lang.reflect.Method.invoke(Method.java:515)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
                                                                                at dalvik.system.NativeStart.main(Native Method)
                                                                             Caused by: java.lang.IllegalStateException: Unable to extract the trust manager on a.a.k@41ff61a0, sslSocketFactory is class com.paypal.android.sdk.bn
                                                                                at a.ak.<init>(Unknown Source)
                                                                                at a.ak.<init>(Unknown Source)
                                                                                at a.am.b(Unknown Source)
                                                                                at com.paypal.android.sdk.bt.<init>(Unknown Source)
                                                                                at com.paypal.android.sdk.payments.PayPalService.a(Unknown Source)
                                                                                at com.paypal.android.sdk.payments.PayPalService.onStartCommand(Unknown Source)
                                                                                at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2970)
                                                                                at android.app.ActivityThread.access00(ActivityThread.java:166) 
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380) 
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                at android.os.Looper.loop(Looper.java:136) 
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5584) 
                                                                                at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                                at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) 
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) 
                                                                                at dalvik.system.NativeStart.main(Native Method) 
     03-20 17:03:46.103 7804-7804/? I/Process: Sending signal. PID: 7804 SIG: 9

我知道这个问题不是由我测试应用程序的设备引起的 - 因为我已经在两个非常不同的设备(Samsung Grand Neo 和 Cubot X15)上测试了这个应用程序并且两个设备都产生了类似的错误。我尝试用谷歌搜索问题来尝试解决问题,但经过数小时的搜索后没有找到解决方案。

如有任何帮助,我们将不胜感激。 SilSur.

所以我花了大约 5 个小时来解决这个问题 - 我通过逐步消除问题的可能原因来实现的。

原来真正的问题是我尝试更新应用程序的匆忙。原因是 PayPal SDK 2.13.3 版本在 'proguard-rules.pro' 文件中有一个非常重要的新规则:

规则如下:

    # This is added for okhttp 3.1.2 bug fix as shown at https://github.com/square/okhttp/issues/2323
    -keepclassmembers class * implements javax.net.ssl.SSLSocketFactory {
         private javax.net.ssl.SSLSocketFactory delegate;
    }

这可以防止 Gradle 的缩小(混淆)过程从 PayPal SDK 中导致安全层套接字工厂出现问题的先前错误修复中删除重要代码。是的 - 这就是解决方法:更新后的应用程序现在可以完美运行(完全符合要求)。

经验教训:确保您的 'proguard-rules' 完全符合预期!

结束,SilSur。