'Both methods have same erasure, yet neither overides the other' SkuDetailsResponseListener() 中的方法冲突错误
'Both methods have same erasure, yet neither overides the other' method clash error in SkuDetailsResponseListener()
我正在尝试实施新的应用内计费实施,因为普通的驱动器 2 实施似乎已放弃支持。以下创建我的 mSkuDetails 地图的代码给我一个奇怪的方法冲突错误。它是从文档中直接复制的,地图插入行除外。
List<String> skuList = new ArrayList<> ();
skuList.add("item1");
skuList.add("item2");
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
billingClient.querySkuDetailsAsync(params.build(),
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(BillingResult billingResult,
List<SkuDetails> skuDetailsList) {
if (billingResult.getResponseCode() ==
BillingClient.BillingResponseCode.OK && skuDetailsList != null) {
for (SkuDetails skuDetails : skuDetailsList) {
mSkuDetailsMap.put(skuDetails.getSku(), skuDetails);//will use this for purchase calls
}
}
}
});
关于此的错误消息至少可以说没有帮助。然而,当我恰好代入:
com.android.billingclient.api.SkuDetails//add prefix 'com.android.billingclient.api.'
对于 'SkuDetails' 的每个实例,像这段代码中的那些奇怪的错误神奇地清除了。还要在 'Purchase':
的每个实例之前添加前缀
com.android.billingclient.api.Purchase//also add prefix before Purchase
修复了其他类似的错误。
这里是有两个替换的工作代码:
List<String> skuList = new ArrayList<> ();
skuList.add("item1");
skuList.add("item2");
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
billingClient.querySkuDetailsAsync(params.build(),
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(BillingResult billingResult,
List<com.android.billingclient.api.SkuDetails> skuDetailsList) {
if (billingResult.getResponseCode() ==
BillingClient.BillingResponseCode.OK && skuDetailsList != null) {
for (com.android.billingclient.api.SkuDetails skuDetails : skuDetailsList) {
mSkuDetailsMap.put(skuDetails.getSku(), skuDetails);//will use this for purchase calls
}
}
}
});
我正在尝试实施新的应用内计费实施,因为普通的驱动器 2 实施似乎已放弃支持。以下创建我的 mSkuDetails 地图的代码给我一个奇怪的方法冲突错误。它是从文档中直接复制的,地图插入行除外。
List<String> skuList = new ArrayList<> ();
skuList.add("item1");
skuList.add("item2");
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
billingClient.querySkuDetailsAsync(params.build(),
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(BillingResult billingResult,
List<SkuDetails> skuDetailsList) {
if (billingResult.getResponseCode() ==
BillingClient.BillingResponseCode.OK && skuDetailsList != null) {
for (SkuDetails skuDetails : skuDetailsList) {
mSkuDetailsMap.put(skuDetails.getSku(), skuDetails);//will use this for purchase calls
}
}
}
});
关于此的错误消息至少可以说没有帮助。然而,当我恰好代入:
com.android.billingclient.api.SkuDetails//add prefix 'com.android.billingclient.api.'
对于 'SkuDetails' 的每个实例,像这段代码中的那些奇怪的错误神奇地清除了。还要在 'Purchase':
的每个实例之前添加前缀com.android.billingclient.api.Purchase//also add prefix before Purchase
修复了其他类似的错误。
这里是有两个替换的工作代码:
List<String> skuList = new ArrayList<> ();
skuList.add("item1");
skuList.add("item2");
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
billingClient.querySkuDetailsAsync(params.build(),
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(BillingResult billingResult,
List<com.android.billingclient.api.SkuDetails> skuDetailsList) {
if (billingResult.getResponseCode() ==
BillingClient.BillingResponseCode.OK && skuDetailsList != null) {
for (com.android.billingclient.api.SkuDetails skuDetails : skuDetailsList) {
mSkuDetailsMap.put(skuDetails.getSku(), skuDetails);//will use this for purchase calls
}
}
}
});