[英]In-app Billing - Item requested not available for purchase
I am working on learning in-app billing but I am having a problem with the google's in-app billing example, the Dungeon one.我正在学习应用内结算,但我对谷歌的应用内结算示例 Dungeon 有疑问。
I have already set up the application, added my public key, and changed the API_VERSION to 1 in the makeRequestBundle().我已经设置了应用程序,添加了我的公钥,并在 makeRequestBundle() 中将 API_VERSION 更改为 1。
I have already exported and signed the application and uploaded it onto Google Play and saved it as a draft with a few pictures and activated the apk.我已经导出并签署了应用程序并将其上传到 Google Play 并将其保存为带有几张图片的草稿并激活了 apk。 I also added both the sword_001 and potion_001 as published in-app purchases!
我还添加了 sword_001 和 potion_001 作为已发布的应用内购买!
Next I installed the signed app onto my phone but when I try to purchase either the sword or the potion I get an Item unavailable error接下来,我将签名的应用程序安装到我的手机上,但是当我尝试购买剑或药水时,出现了“物品不可用”错误
The item you requested is not available for purchase.
您请求的项目无法购买。
I even tried on a different device to make sure it wasn't because developer's can't purchase their own products, and I get the same message on both devices.我什至在不同的设备上试过以确保这不是因为开发人员无法购买他们自己的产品,而且我在两台设备上都收到了相同的消息。
What have I missed?我错过了什么?
Check your versionCode
.检查您的
versionCode
。 It can't be higher than the last published/unpublished version in any of your distribution channels (prod/beta/alpha).它不能高于您的任何分发渠道(产品/测试版/阿尔法)中最后发布/未发布的版本。
In app billing seems fraught with pitfalls, but this is what I found that affected availability of items for purchase and also suitability of application:应用内计费似乎充满了陷阱,但我发现这会影响购买物品的可用性以及应用程序的适用性:
Hope this helps somebody.希望这可以帮助某人。 I have to say its a pretty complicated system, with not many switten down answers, and I nearly gave up on it.
我不得不说这是一个相当复杂的系统,没有多少答案,我几乎放弃了。
If your app are on closed alpha testing, you have to sign in with your test account to Opt-in URL;如果您的应用正在进行封闭式 Alpha 测试,您必须使用您的测试帐户登录到 Opt-in URL;
https://play.google.com/apps/testing/{your.app.namespace}
My experience on this error is:我对这个错误的经验是:
Make sure to upload the signed APK to developer console.确保将签名的 APK 上传到开发者控制台。
Make sure to install the signed APK on your device not launch the app in the debugger.确保在您的设备上安装已签名的 APK,而不是在调试器中启动应用程序。
Make sure to create a test account in your developer console.确保在您的开发者控制台中创建一个测试帐户。
Make sure to sign in your device with your test account.确保使用您的测试帐户登录您的设备。
Make sure to create in app billing in your developer console and finally activate the item from the console!!!确保在您的开发者控制台中创建 in app billing 并最终从控制台激活该项目!!! (this is the one that got me after fully following google's tutorial)
(这是在完全遵循谷歌的教程后让我得到的)
It's no longer sufficient to just upload an unpublished draft apk to test in-app billing.仅仅上传一个未发布的草稿 apk 来测试应用内计费是不够的。 What you need to do is upload an apk to the alpha or beta apk section on the Developer Console.
您需要做的是将 apk 上传到开发人员控制台上的 alpha 或 beta apk 部分。 Then, you need to publish it.
然后,您需要发布它。 If you also have a draft apk in the Production APK section, be sure to delete it before you publish.
如果您在 Production APK 部分也有草稿 apk,请务必在发布前将其删除。 Otherwise it will be available to everyone.
否则它将对每个人都可用。
Publishing an alpha or beta apk makes that apk available to only those testers that you specify/allow.发布 alpha 或 beta apk 使该 apk 仅可用于您指定/允许的那些测试人员。
Here is Google's documentation on this:这是谷歌的文档:
https://support.google.com/googleplay/android-developer/answer/6062777?rd=1 https://support.google.com/googleplay/android-developer/answer/6062777?rd=1
Well I found a solution to my problem.好吧,我找到了解决我的问题的方法。 I wasn't able to get Google's in app purchasing example to work but I was able to get this InApp Billing Tutorial to work using the steps I mentioned in my original post.
我无法让 Google 的应用内购买示例发挥作用,但我能够使用我在原始帖子中提到的步骤使这个应用内结算教程起作用。
If nothing else this may be helpful to someone to see all of the steps that need to be done to test one of the in-app billing examples.如果没有别的,这可能有助于某人查看测试应用内计费示例之一所需的所有步骤。
Publishing the app did the trick for me(and leaving it published (!)).发布应用程序对我有用(并让它发布(!))。 I had to wait a bit for Google to update their database as well, as mentioned elsewhere, changes on Google Play are not immediate.
我不得不等待 Google 更新他们的数据库,正如其他地方提到的,Google Play 上的变化不会立即发生。
Also had this problem for a couple of days and searched around a lot.也有这个问题几天并搜索了很多。 I found this guy who said deleting the app and then reuploading fixed his problem, and that actually worked for me aswell.
我发现这个人说删除应用程序然后重新上传解决了他的问题,这实际上对我也有用。
Try that, delete your app from the developer console entirely.尝试一下,从开发者控制台中完全删除您的应用程序。 And reuppload a new signed apk and set it up all over again
并重新上传一个新签名的 apk 并重新设置
Anecdotal Supplement: If you have an existing app in the portal already and you want to test a signed version, but not upload it into the portal for distribution.轶事补充:如果您在门户中已经有一个现有的应用程序,并且您想要测试签名版本,但不想将其上传到门户进行分发。 Do the normal steps to build a signed version BUT use your latest version code that is uploaded into the portal.
执行正常步骤来构建签名版本,但使用上传到门户的最新版本代码。 You will will be able to do a quick and dirty test of purchasing (you can't upload this version on the Google Play portal, but it's a means to an end for a localized test (or even as a way to allow side loaded distributed versions/flavors that use Google Play for billing legitimately.)
您将能够对购买进行快速而肮脏的测试(您无法在 Google Play 门户上上传此版本,但它是结束本地化测试的一种手段(或者甚至作为一种允许侧面加载分布式的方式)使用 Google Play 进行合法计费的版本/风格。)
3:) 3:)
Check if your device have more than one account then remove other accounts and keep the account you have entered in play console then it will be solved.检查您的设备是否有多个帐户然后删除其他帐户并保留您在游戏机中输入的帐户然后它就会解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.