Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 刷新资源清册时出错。应用内计费_Java_Android_In App Purchase_Google Play_In App Billing - Fatal编程技术网

Java 刷新资源清册时出错。应用内计费

Java 刷新资源清册时出错。应用内计费,java,android,in-app-purchase,google-play,in-app-billing,Java,Android,In App Purchase,Google Play,In App Billing,我正在设置和测试应用内计费。我设法购买了android.test.purchased,它做了它应该做的。但是现在我需要使用它来继续我的测试。问题是我拿不到存货 调用此函数时,我会得到结果。调用isFaliure()时,我无法获取库存 IabHelper.QueryInventoryFinishedListener _gotInventoryListener = new IabHelper.QueryInventoryFinishedListener() { @Override

我正在设置和测试应用内计费。我设法购买了android.test.purchased,它做了它应该做的。但是现在我需要使用它来继续我的测试。问题是我拿不到存货

调用此函数时,我会得到结果。调用isFaliure()时,我无法获取库存

IabHelper.QueryInventoryFinishedListener _gotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {

        @Override
        public void onQueryInventoryFinished(IabResult result, Inventory inventory) {

            if (_iabHelper == null) return;

            if (result.isFailure()) {
                Log.d(TAG, "Failed to query inventory: " + result);
                return;
            }

            Log.d(TAG, "Query inventory was successful.");

            Purchase premiumPurchase = inventory.getPurchase(SKU_PREMIUM);
            _isPremium = (premiumPurchase != null && verifyDeveloperPayload(premiumPurchase));
            Log.d(TAG, "User is " + (_isPremium ? "PREMIUM" : "NOT PREMIUM"));

            update();
        }
    };
它记录错误消息

无法查询库存:结果:刷新库存时出错 (查询拥有的项目)。(回复:-1003:购买签名 验证失败)

购买的android.test.com仍然是自己的-它不会让我再次购买它。我的手机有网络连接,所以不是这样

我还没有将签名的APK上传到Google Play,即使我使用Google的静态ID进行测试,这有关系吗?解决了这个问题。。。 静态购买ID似乎有问题。 这是我在线程中找到的解决方案:

我找到了答案:

“这里有一个建议:确保正确保存您的账单密钥(Base64EncodedPublicey)。这是我的问题,毕竟…”

Base64EncodedPublicey来自另一个应用程序


这是我的解决方案

嘿,你!救了我的命!谢谢你的回答帮助了我。
If you have used the android.test.purchased then one way to get rid of the error is to do the following:-

 1. Edit Security.java and change the "return false" line in the
    verifyPurchase to "return true" - this is temporary, we'll be
    putting it back in a minute.
 2. In your QueryInventoryFinishedListener, after the "if
    (result.isFailure()) {...}" lines add the following to consume and
    get rid of your never ending android.test.purchased item:-

    if (inventory.hasPurchase(SKU_ANDROID_TEST_PURCHASE_GOOD)) {
    mHelper.consumeAsync(inventory.getPurchase(SKU_ANDROID_TEST_PURCHASE_GOOD),null);
    }
 3. Run your app so the consunmeAsync happens, this gets rid of the
    "android.test.purchased" item on the server.
 4. Remove the consumeAsync code (or comment it out). Back in the
    Security.java, change the "return true" back to "return false".