Error in getSku when updating Google Play Billing to version 5

Tiempo de lectura: < 1 minuto

Reading time: < 1 minute

When we update the Google Play Billing library to version 5:

com.android.billingclient:billing:5.1.0

We may encounter the following issue:

This is because now, to obtain the purchased product code, we no longer call the getSku() function. Instead, when iterating through the list of purchases, we need to call it in the following way:

listaPasarLogros.add(purchase.getProducts().get(0));

Since now a purchase can have multiple products at once.

This list will return the identifier of the first element (the old SKU).

Leave a Comment