Billing Compatibility SDK onProductDetailsResponse returning NULL ProductDetails

I’m probably misunderstanding this, but I’m trying the Appstore Billing Compatibility SDK with my existing Google Play Kotlin code. It has a declaration on ProductDetailsResponseListener as follows:

override fun onProductDetailsResponse(billingResult: BillingResult, productDetailsList: MutableList<ProductDetails>) { }

But when I try to test, Kotlin crashes with a message:

java.lang.NullPointerException: Parameter specified as non-null is null: method com.eggheadgames.appcore.AtriumActivity.onProductDetailsResponse, parameter productDetailsList

Unfortunately I can’t test productDetailsList for null because it’s not declared as nullable - and if I try, then it’s incompatible with the compatibility library (as well as the Google library). Or so it seems …

E.g. declared as follows (adding a ? at the end):

override fun onProductDetailsResponse(billingResult: BillingResult, productDetailsList: MutableList?)

then I get an error:

Type mismatch: inferred type is MutableList<com.eggheadgames.appcore.ProductDetails /* = />? but Collection<com.eggheadgames.appcore.ProductDetails / = */> was expected

I guess the question is, can ProductDetails ever be NULL? And, if so, how can I declare that to Kotlin?


Ah, I see the Google declaration is:

public interface ProductDetailsResponseListener {
    void onProductDetailsResponse(@NonNull BillingResult var1, @NonNull List<ProductDetails> var2);

so it should never be null …

Hi there,

Thanks for posting! We have forwarded your question to the appropriate team, we will update you as soon as we have more information on this.