android google play billing library v2.0.3 acknowledgePurchase failed with error code 5 in Android Q (api 29)

android google play billing library v2.0.3 acknowledgePurchase failed with error code 5 in Android Q (api 29)

我已按照 google 示例代码进行操作,但它未能确认购买非消耗品并获得退款,仅在 Android Q (api 29)。

返回的错误是代码 5,即 DEVELOPER_ERROR,在文档中定义为 "Invalid arguments provided to the API. This error can also indicate that the application was not correctly signed or properly set up for In-app Billing in Google Play, or does not have the necessary permissions in its manifest"。

https://developer.android.com/google/play/billing/billing_library_overview#acknowledge

知道这是怎么回事吗?它在其他 Android 版本的手机中运行良好。

尝试了很多选项后,终于找到了答案。

我试图确认已经确认的购买。因此,旧的 android 版本基本上接受了这一点,而在 Android Q 中,它 returns 是一个错误。所以我检查了 purchase.isAcknowledged 问题就解决了。