【发布时间】:2013-03-18 10:17:52
【问题描述】:
我有一个已添加到应用计费 (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);
}
【问题讨论】:
-
您是否在应用中使用 Google“默认”代码?
-
请发帖
OnIabSetupFinishedListener监听代码 -
@class stacker: 不是 100% 确定你的意思……但我使用的是 google 提供的 IabHelper 类。
-
@Mick :不确定问题出在哪里,也许你缺少一些参数。请查看In app billing (v3) 的这个很好的工作示例