无法通过 getIntentSender() 启动活动 ProxyBillingActivity、NullPointerException

问题描述 投票:0回答:1

我们正在使用最新的 Google Play 计费客户端

com.android.billingclient:billing:4.1.0
,如 https://developer.android.com/google/play/billing/integrate

中所述

有时我们会在崩溃日志中遇到这种不可重现的异常,主要是 Android 10 设备。

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.app/com.android.billingclient.api.ProxyBillingActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.IntentSender android.app.PendingIntent.getIntentSender()' on a null object reference
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3654)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3806)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:237)
    at android.app.ActivityThread.main(ActivityThread.java:8154)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.IntentSender android.app.PendingIntent.getIntentSender()' on a null object reference
    at com.android.billingclient.api.ProxyBillingActivity.onCreate(com.android.billingclient:billing@@4.1.0:12)
    at android.app.Activity.performCreate(Activity.java:7963)
    at android.app.Activity.performCreate(Activity.java:7952)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3629)
    ... 11 more

有什么想法如何修复/捕获吗?

google-play google-play-services
1个回答
0
投票

我今天也遇到这个问题了
对我来说,问题似乎不是由于错误引起的,而可能是由机器人或某人随机触发活动引起的,这会导致访问意图时出现 NullPointerException。
我在其他活动中也遇到过类似的问题,这些活动并非设计为在没有参数的情况下启动。

© www.soinside.com 2019 - 2024. All rights reserved.