gpt4 book ai didi

android - 应用内计费 (v3) - 了解空指针异常

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:00:57 27 4
gpt4 key购买 nike

我有一个应用,我在其中添加了应用计费 (v3)。已发布的应用程序似乎在我测试的(公认的少数)设备上运行良好。代码用proguard混淆了,但是我保留了对应的proguard mapping.txt。

一些购买是成功的,但我也收到了崩溃的报告。然后我使用 retrace.bat 来翻译崩溃堆栈跟踪并得到以下结果:

java.lang.NullPointerException

at com.mycompany.mygame.util.IabHelper.void startSetup(com.mycompany.mygame.util.IabHelper$OnIabSetupFinishedListener)(Unknown Source)
void dispose()
void launchPurchaseFlow(android.app.Activity,java.lang.String,int,com.mycompany.mygame.util.IabHelper$OnIabPurchaseFinishedListener,java.lang.String)
boolean handleActivityResult(int,int,android.content.Intent)
com.mycompany.mygame.util.Inventory queryInventory$337baa91(boolean,java.util.List)
void queryInventoryAsync$69bb631c(java.util.List,com.mycompany.mygame.util.IabHelper$QueryInventoryFinishedListener)
java.lang.String getResponseDesc(int)
int getResponseCodeFromBundle(android.os.Bundle)
int queryPurchases(com.mycompany.mygame.util.Inventory,java.lang.String)
int querySkuDetails(java.lang.String,com.mycompany.mygame.util.Inventory,java.util.List)
void logDebug(java.lang.String)

at com.mycompany.mygame.util.IabHelper.void startSetup(com.mycompany.mygame.util.IabHelper$OnIabSetupFinishedListener)(Unknown Source)
void dispose()
void launchPurchaseFlow(android.app.Activity,java.lang.String,int,com.mycompany.mygame.util.IabHelper$OnIabPurchaseFinishedListener,java.lang.String)
boolean handleActivityResult(int,int,android.content.Intent)
com.mycompany.mygame.util.Inventory queryInventory$337baa91(boolean,java.util.List)
void queryInventoryAsync$69bb631c(java.util.List,com.mycompany.mygame.util.IabHelper$QueryInventoryFinishedListener)
java.lang.String getResponseDesc(int)
int getResponseCodeFromBundle(android.os.Bundle)
int queryPurchases(com.mycompany.mygame.util.Inventory,java.lang.String)
int querySkuDetails(java.lang.String,com.mycompany.mygame.util.Inventory,java.util.List)
void logDebug(java.lang.String)

at com.mycompany.mygame.util.IabHelper$2.void run()(Unknown Source)
at java.lang.Thread.run(Thread.java:1019)

我不太清楚如何读取堆栈跟踪,但我猜测 OnIabPurchaseFinishedListener 中可能有一个空指针...?如果是这样,那是怎么发生的?

编辑:“launchPurchaseFlow”出现在堆栈跟踪中是否意味着程序在用户尝试购买东西时崩溃了?

编辑: 这里是听众的要求:

/**
* Callback that notifies when a purchase is finished.
*/
public interface OnIabPurchaseFinishedListener {
/**
* Called to notify that an in-app purchase finished. If the purchase was successful,
* then the sku parameter specifies which item was purchased. If the purchase failed,
* the sku and extraData parameters may or may not be null, depending on how far the purchase
* process went.
*
* @param result The result of the purchase.
* @param info The purchase information (null if purchase failed)
*/
public void onIabPurchaseFinished(IabResult result, Purchase info);
}

最佳答案

也许这与这里提出的问题有关: https://code.google.com/p/android/issues/detail?id=42338

更新后的代码尚未推送到 SDK 管理器,但您可以在此处查看与此问题相关的所有更改:https://code.google.com/p/marketbilling/source/detail?r=7ec85a9b619fc5f85023bc8125e7e6b1ab4dd69f

有 4 个文件受此问题影响。进行他们建议的更改,看看您是否仍然遇到同样的问题。

关于android - 应用内计费 (v3) - 了解空指针异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15417019/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com