简体   繁体   English

SkuDetailsResponseListener() 中的“两种方法都具有相同的擦除功能,但都不会覆盖另一个”方法冲突错误

[英]'Both methods have same erasure, yet neither overides the other' method clash error in SkuDetailsResponseListener()

I'm attempting to implement the new inapp billing implementation as the trivial drive 2 implementation appears to have dropped support.我正在尝试实施新的应用内计费实施,因为普通驱动器 2 实施似乎已放弃支持。 The following code to create my mSkuDetails map gives me an odd method clash error.以下用于创建我的 mSkuDetails 映射的代码给了我一个奇怪的方法冲突错误。 It's copied right from the docs except for the Map insertion line.除了 Map 插入行之外,它是从文档中直接复制的。

 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
                                    }
                                }
                            }
                        });

在此处输入图片说明

在此处输入图片说明

The error messages on this weren't helpful to say the least.至少可以说,关于此的错误消息没有帮助。 However, when I happened to substititute:但是,当我碰巧替换时:

com.android.billingclient.api.SkuDetails//add prefix 'com.android.billingclient.api.'

for every instance of 'SkuDetails', weird errors like the ones in this code piece magically cleared up.对于“SkuDetails”的每个实例,像这段代码中的那些奇怪的错误都神奇地清除了。 Also adding the prefix before every instance of 'Purchase':还要在“购买”的每个实例之前添加前缀:

com.android.billingclient.api.Purchase//also add prefix before Purchase

fixed other similar errors.修复了其他类似的错误。

Here is the working code with two substitutions:这是带有两个替换的工作代码:

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
                                }
                            }
                        }
                    });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 两种方法具有相同的擦除,但是都不能覆盖另一种方法 - Both methods have same erasure, yet neither overrides the other 两种方法都有相同的擦除,但都没有覆盖另一个 - Both methods have same erasure yet neither overrides the other 名称冲突 - 具有相同的擦除但在方法参数generic中不会覆盖另一个 - Name clash - have the same erasure yet neither overrides the other in method parameter generic “'Mapper' 中的 map(From)' 与 'CursorToMessageImpl' 中的 'map(Object)' 冲突;两种方法具有相同的擦除,但都不会覆盖另一个 - "map(From)' in 'Mapper' clashes with 'map(Object)' in 'CursorToMessageImpl'; both methods have same erasure, yet neither overrides the other 实现Comparable,compareTo名称冲突:“具有相同的擦除,但不会覆盖其他” - Implementing Comparable, compareTo name clash: “have the same erasure, yet neither overrides the other” 集具有相同的擦除,但没有一个覆盖另一个错误 - Set have the same erasure, yet neither overrides the other error 在实现ConsumerSeekAware接口时,如何使“这两种方法都具有相同的擦除能力,但两者都不能覆盖另一个方法”的警告静音? - How do I silence the “both methods have same erasure yet neither overrides the other” warning while implementing the ConsumerSeekAware interface? Java名称冲突,具有相同的擦除方式,但两者都不隐藏 - Java name clash, have the same erasure, neither hides the other 无法覆盖onBeforeConvert:“......有相同的删除,但都没有覆盖其他” - Cannot Override onBeforeConvert: “…have the same erasure, yet neither overrides the other” 界面和一个类。名称冲突:相同的擦除,但都不会覆盖其他 - interface and a class. name clash: same erasure, yet neither overrides other
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM