gpt4 book ai didi

Android in App billing test purchase 崩溃 Play store

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

我目前正在开发一款应用内计费应用。一切正常。我已经在 Beta channel 中发布了该应用程序,并让测试用户使用真实元素对其进行了测试,并且它可以正常工作。

然而,在调试时,我正在使用 android.test.purchased 项目,当我按下购买按钮时,我的游戏商店崩溃了。

enter image description here

我收到以下错误:

E/AndroidRuntime: FATAL EXCEPTION: main 
Process: com.android.vending, PID: 25463
java.lang.NullPointerException: Attempt to read from field 'com.google.android.finsky.protos.Acquisition$AutoDismissTemplate com.google.android.finsky.protos.Acquisition$PostAcquisitionPrompt.autoDismissTemplate' on a null object reference
at com.google.android.finsky.billing.SuccessStep.getLayoutResId(SuccessStep.java:75)
at com.google.android.finsky.billing.lightpurchase.PurchaseFragment.onStateChange(PurchaseFragment.java:31066)
at com.google.android.finsky.fragments.SidecarFragment.notifyListener(SidecarFragment.java:255)
at com.google.android.finsky.fragments.SidecarFragment.setState(SidecarFragment.java:250)
at com.google.android.finsky.billing.lightpurchase.CheckoutPurchaseSidecar.confirmAuthChoiceSelected(CheckoutPurchaseSidecar.java:631)
at com.google.android.finsky.billing.lightpurchase.PurchaseFragment.onStateChange(PurchaseFragment.java:32156)
at com.google.android.finsky.fragments.SidecarFragment.notifyListener(SidecarFragment.java:255)
at com.google.android.finsky.fragments.SidecarFragment.setState(SidecarFragment.java:250)
at com.google.android.finsky.billing.lightpurchase.CheckoutPurchaseSidecar.access$1900$2f730cd3(CheckoutPurchaseSidecar.java:72)
at com.google.android.finsky.billing.lightpurchase.CheckoutPurchaseSidecar$1.run(CheckoutPurchaseSidecar.java:1009)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-23 02:22:43.202 590-739/? W/ActivityManager: Force finishing activity com.android.vending/com.google.android.finsky.billing.lightpurchase.IabV3Activity


Purchase finished: IabResult: Null data in IAB result (response: -1002:Bad response received), purchase: null
Error purchasing: IabResult: Null data in IAB result (response: -1002:Bad response received)

有时购买会在此之后继续进行,有时我的应用会崩溃。

我在几台设备上对此进行了测试(Android 6.0 的 Nexus 7、Android 5.1.1 的 Note 5、Android 4.3 的 Galaxy S3、Android 4.4 的 LG G3),它们都具有相同的行为。

让我生气的是,真实的应用程序项目完美无缺。这让我觉得这意味着我的代码没问题。但是在测试项目中发生这种情况,让我担心发布时可能会在真实用户的真实项目中重复出现这种情况。

如果我做错了什么导致 Play 商店崩溃,或者这可能发生,感谢您的帮助让我知道?

请注意,我是 Android 开发的新手。

谢谢。

这是我的应用内计费代码:

 ///... part of onCreate:

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 {
// Hooray, IAB is fully set up. Now, let's get an inventory of
// stuff we own.
Log.d(TAG, "Setup successful. Querying inventory.");
mHelper.queryInventoryAsync(mGotInventoryListener); }
}
});

////////////////

public void startPurchase(String ITEM_SKU) { // Start the purchase process here

String purchaseToken = "inapp:" + getPackageName() + ":"+ ITEM_SKU;

Log.d(TAG, "Purchase started for : " + ITEM_SKU);

mHelper.launchPurchaseFlow(this, ITEM_SKU, 10002,
mPurchaseFinishedListener, purchaseToken);
}


// Callback for when a purchase is finished
IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener() {
public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
Log.d(TAG, "Purchase finished: " + result + ", purchase: "
+ purchase);
if (result.isFailure()) {
Log.d(TAG,"Error purchasing: " + result);
if (result.getResponse()==7){
if(myInventory.hasPurchase(ITEM_SKU))
{
Log.d(TAG,"Ooops, Item already purchased, consume it");
mHelper.consumeAsync(myInventory.getPurchase(ITEM_SKU),mConsumeFinishedListener2);
}
}
return;
}

Log.d(TAG, "Purchase successful.");

if (purchase.getSku().equals(ITEM_SKU)) {
mHelper.consumeAsync(purchase, mConsumeFinishedListener);

}
}
};

IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result,
Inventory inventory) {
Log.d(TAG, "Query inventory finished.");

if (result.isFailure()) {
Log.d(TAG,"Failed to query inventory: " + result);
return;
}

Log.d(TAG, "Query inventory was successful.");

myInventory = inventory;
//Process inventory


}
};

IabHelper.OnConsumeFinishedListener mConsumeFinishedListener =
new IabHelper.OnConsumeFinishedListener() {
public void onConsumeFinished(Purchase purchase,
IabResult result) {

if (result.isSuccess()) {
Log.d(TAG,"consume successful for " + purchase.getSku() + " & " + result.getMessage());
updateCoinsAndScore(coinsToAdd, 0);
Toast.makeText(getApplication(), "تم إضافة عدد " + coinsToAdd + " عملات إلى رصيدك", Toast.LENGTH_LONG).show();
//reset values
coinsToAdd=0;
ITEM_SKU="";
} else {
Log.d(TAG, "Consume failed " + result.getMessage()); }
}
};

IabHelper.OnConsumeFinishedListener mConsumeFinishedListener2 =
new IabHelper.OnConsumeFinishedListener() {
public void onConsumeFinished(Purchase purchase,
IabResult result) {

if (result.isSuccess()) {
Log.d(TAG,"consumed, starting purchase again");
Log.d(TAG,"consume successful for " + purchase.getSku() + " & " + result.getMessage());

startPurchase(ITEM_SKU);

} else {
Log.d(TAG,"Consume failed " + result.getMessage()); }
}
};

最佳答案

问题出现在 Google Play v6.0.0 中,现在已在 v6.0.5 中修复(已在三星和 Nexus 设备上确认)。

如果您没有自动获得 Google Play 更新,您可以从 ApkMirror.com 手动下载。等等

关于Android in App billing test purchase 崩溃 Play store,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33861848/

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