Android Play Billing Library: onSkuDetailsResponse responseCode is 0, but the size of skuDetailsList is also 0

TheOska picture TheOska · Oct 17, 2017 · Viewed 8.1k times · Source

I'm now using the new Play Billing Library

Basically, I followed the documentation to query available items to purchase

 SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
            params.setSkusList(skuList).setType(itemType);
            mBillingClient.querySkuDetailsAsync(params.build(),
                    new SkuDetailsResponseListener() {

                        @Override
                        public void onSkuDetailsResponse(int responseCode,
                                                         List<SkuDetails> skuDetailsList) {
                            listener.onSkuDetailsResponse(responseCode, skuDetailsList);
                        }

However, the responseCode is 0 and the list is also empty. But I checked onBillingSetupFinished is successful. The skuList that provided to SkuDetailsParams.Builder is not empty, and the values inside the skuList (sku_id) is also same as Product ID that specifies on Google Play Console.

Does anyone know the reason? Thanks!!

Answer

hrach picture hrach · Dec 15, 2018

I have spent few hours with this issue and the problem was that my debug build/CI builds had applicationIdSuffix. So only production build with proper applicationId was able to retrieve the products.