简体   繁体   English

Android应用程式内购买失败

[英]Android in-app purchase failed

I'm trying to implement in-app billing system in my application, but I cannot query the inventory to retrieve the subscriptions, because I'm getting the following error: 我正在尝试在我的应用程序中实现应用内结算系统,但是由于出现以下错误,我无法查询广告资源来检索订阅:

IabResult: Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)

What have I done: 我做了什么:

  1. Signed APK is uploaded in Google Play's Store in closed ALPHA and it's published 已签名的APK已在封闭的ALPHA中上传到Google Play的商店中,并已发布
  2. I have added the tester account (gmail) in the testers section (the same gmail account is used on the testing device) 我在“测试人员”部分添加了测试人员帐户(gmail)(在测试设备上使用了相同的gmail帐户)
  3. I have sent an e-mail with a link to the testers e-mail to "become a tester" for the application (I also see the application in the Play Store if I search for it) 我已经发送了一封电子邮件,其中包含指向测试人员的电子邮件的链接,以“成为测试人员”申请该应用程序(如果我搜索该应用程序,我还会在Play商店中看到该应用程序)
  4. I have created the subscriptions and all are published 我已经创建了订阅,所有订阅都已发布
  5. The application was reviewed by Google and all seems to be fine (status: published) 该应用程序已由Google审核,并且一切正常(状态:已发布)
  6. The application version name "1.1.5-alpha-15", version code "15" and package name is the same as on Google Play's store 应用程序版本名称“ 1.1.5-alpha-15”,版本代码“ 15”和程序包名称与Google Play商店中的相同

The code (in activity): 代码(活动中):

private IabHelper mIabHelper;    

// Init setup listener
private IabHelper.OnIabSetupFinishedListener mIabSetupListener = new IabHelper.OnIabSetupFinishedListener() {
   @Override
   public void onIabSetupFinished(IabResult result) {
      if (result.isSuccess()) {
         // Load success, now query for inventory
         List<String> skus = new ArrayList();
         skus.add("packagename.org.dev.subscription.monthly");
         skus.add("packagename.org.dev.subscription.yearly");

         mIabHelper.queryInventoryAsync(true, skus, mQueryInventoryFinishedListener);
      }
   }
};

// Listener to load the subscriptions
private IabHelper.QueryInventoryFinishedListener mQueryInventoryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
   @Override
   public void onQueryInventoryFinished(IabResult result, Inventory inv) {
      if (result.isFailure()) {
         Log.e(TAG, "Failure, check error!");
         return;
      }
   }
};

@Override
protected void onCreate(Bundle savedState) {
   super.onCreate(savedState);

   mIabHelper = new IabHelper(this, PUBLIC_KEY_BASE_64);
   mIabHelper.enableDebugLogging(true, "BILLING");
   mIabHelper.startSetup(mIabSetupListener);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (mIabHelper == null || !mIabHelper.handleActivityResult(requestCode, resultCode, data))
      super.onActivityResult(requestCode, resultCode, data);
}

@Override
protected void onDestroy() {
    super.onDestroy();

    if (mIabHelper != null) {
        mIabHelper.dispose();
    }
}

I copied the same APK on the device (signed) and installed it, but I'm getting the above error. 我在设备上复制了相同的APK(签名)并安装了它,但出现上述错误。 I also run the application in debug mode, same error. 我还以调试模式运行该应用程序,出现同样的错误。 I don't know what to do. 我不知道该怎么办。

I have seen here (stackoverflow) that Google APIs is caching some data. 我在这里(stackoverflow)看到Google API正在缓存某些数据。 Should I do a factory reset? 我应该恢复出厂设置吗? Or how can I clear the cached data? 或者如何清除缓存的数据?

Signature verification fails mostly if the base 64 public key for your app is not correct. 如果您的应用程序的基数为64的公共密钥不正确,则签名验证失败。 make sure you are using correct "PUBLIC_KEY_BASE_64". 确保您使用的是正确的“ PUBLIC_KEY_BASE_64”。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM