当我查询 Google InApp Billing 项目的产品列表时,我收到 Null Exception 错误。
我在 In-App Developer Console 网站上添加了一项,它的状态显示为“活动”;
下面是我的代码。
// Listener that's called when we finish querying the items and subscriptions we own
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
Log.d(TAG, "Query inventory finished 15.");
if (result.isFailure()) {
Log.d(TAG,"Failed to query inventory: " + result);
return;
}
SkuDetails productDetails = inventory.getSkuDetails(SKU_ANATVITALSIGNS);
// Log.d(TAG,"Gas Price is: " + productDetails.getPrice());
if (productDetails != null){
Log.d(TAG,"Deck price is: " + productDetails.getPrice());
}else{
Log.d(TAG,"No Product Detail" );
}
Log.d(TAG, "Query inventory was successful.");
// updateUi();
// setWaitScreen(false);
Log.d(TAG, "Initial inventory query finished; enabling main UI.");
}
例如,当我尝试获取“productDetails.getPrice()”时程序出错。
任何帮助表示赞赏。这已经是两天的头疼了。
TIA