我有一个应用程序,其中我添加了应用程序结算(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);
}
答案 0 :(得分:5)
这可能与此处提出的问题有关: https://code.google.com/p/android/issues/detail?id=42338
更新后的代码尚未推送到SDK Manager,但您可以在此处查看与此问题相关的所有更改:https://code.google.com/p/marketbilling/source/detail?r=7ec85a9b619fc5f85023bc8125e7e6b1ab4dd69f
此问题影响了4个文件。进行他们建议的更改,看看是否仍然遇到同样的问题。