How to correctly import BillingResponse with newest version of billing client (billing:2.0.1)

the*_*ter 5 java android gradle in-app-billing

I'm upgrading my version of android billing api from 1.2.2 to 2.0.1. But now my import of the '''BillingResponse''' api is returning an error. How can I properly import BillingResponse with version 2.0.1?

I'm working with gradle inside of Android Studio.

I've tried: - Cleaning and rebuilding my project - Closing the application and reopening - Restarting my machine - File > Sync project with gradle files

None of those worked so far with 2.0.1, but when I go back to 1.2.2 version of the android billing API it works again! I could not find any documentation that BillingResponse had been deprecated so I was expecting it to work even with an updated api


My relevant gradle dependencies:

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation project(':libcocos2dx')
  implementation 'com.google.android.gms:play-services-games:17.0.0'
  implementation 'com.google.android.gms:play-services-auth:16.0.1'
  implementation 'com.android.billingclient:billing:2.0.1'
Run Code Online (Sandbox Code Playgroud)

My import statements inside of BillingProvider.java which implements PurchasesUpdatedListener:

import com.android.billingclient.api.BillingClient;
import com.android.billingclient.api.BillingClient.BillingResponse;
import com.android.billingclient.api.BillingClient.FeatureType;
import com.android.billingclient.api.BillingClient.SkuType;
Run Code Online (Sandbox Code Playgroud)

^ note that all of the other imports are working here except the .BillingResponse one!

I expected the BillingResponse to still be available in 2.0.1 but it can't seem to find it now that I have upgraded...

sec*_*ond 2

检查https://developer.android.com/google/play/billing/billing_library_releases_notes

计费结果返回值

之前返回 BillingResponse 整数值的 API 现在返回 BillingResult 对象。BillingResult 包含 BillingResponse 整数以及可用于诊断错误的调试字符串。调试字符串使用 en-US 区域设置,并不意味着向最终用户显示。