我为我的Android应用实施了应用内购买。应用内购买功能在我的设备和模拟器上都能正常工作。但是,在应用程序上传到Google Play后,我在Google Play开发者控制台上收到了此崩溃报告,这是我的用户面临的问题。
java.lang.IllegalStateException:
at inappbilling.util.IabHelper.checkNotDisposed (IabHelper.java)
or .flagStartAsync (IabHelper.java)
at inappbilling.util.IabHelper.checkSetupDone (IabHelper.java)
or .flagEndAsync (IabHelper.java)
or .getResponseCodeFromBundle (IabHelper.java)
or .getResponseCodeFromIntent (IabHelper.java)
or .getResponseDesc (IabHelper.java)
or .handleActivityResult (IabHelper.java)
or .launchPurchaseFlow (IabHelper.java)
or .queryInventory (IabHelper.java)
or .queryInventoryAsync (IabHelper.java)
or .queryPurchases (IabHelper.java)
or .querySkuDetails (IabHelper.java)
or .startSetup (IabHelper.java)
at inappbilling.util.IabHelper.checkSetupDone (IabHelper.java)
or .flagEndAsync (IabHelper.java)
or .getResponseCodeFromBundle (IabHelper.java)
or .getResponseCodeFromIntent (IabHelper.java)
or .getResponseDesc (IabHelper.java)
or .handleActivityResult (IabHelper.java)
or .launchPurchaseFlow (IabHelper.java)
or .queryInventory (IabHelper.java)
or .queryInventoryAsync (IabHelper.java)
or .queryPurchases (IabHelper.java)
or .querySkuDetails (IabHelper.java)
or .startSetup (IabHelper.java)
我的IabHelper
已在onCreate
中调用。
String base64EncodedPublicKey =
"<license key here>";
mHelper = new IabHelper(this, base64EncodedPublicKey);
mHelper.startSetup(new
IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result)
{
if (!result.isSuccess()) {
Log.d(TAG, "In-app Billing setup failed: " +
result);
} else {
Log.d(TAG, "In-app Billing is set up OK");
}
}
});
这是我的购买成品听众:
IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener
= new IabHelper.OnIabPurchaseFinishedListener() {
public void onIabPurchaseFinished(IabResult result,
Purchase purchase)
{
if (result.isFailure()) {
checkItem();
return;
}
else if (purchase.getSku().equals(ITEM_SKU)) {
removeAds();
}
}
};
我的查询库存已完成:
public void checkItem() {
mHelper.queryInventoryAsync(mReceivedInventoryListener);
}
IabHelper.QueryInventoryFinishedListener mReceivedInventoryListener
= new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result,
Inventory inventory) {
if (mHelper == null) return;
Purchase purchase = inventory.getPurchase(ITEM_SKU);
if (purchase != null) {
removeAds();
}
}
};
答案 0 :(得分:0)
您是谷歌游戏面板中的定义项目吗? 你是否将Google Play安装到了设备上?