当前的Andr​​oid IAB参考Andr、oid、IAB

2023-09-05 03:57:15 作者:忘记爱过她

我一直在挣扎了Android IAB V3有一段时间了。我有它的工作始终在我的测试设备。然而,我的崩溃报告服务,显示了两个经常性崩溃:一个是空指针异常,一个用于非法状态异常。我试着更新谷歌样品codeW /从众多面临类似问题的用户#1的建议。我已经通过了读崩溃报告,做研究,试图修复崩溃,提交更新,再次看到同样的崩溃报告的循环几次。我认为现在是时候了不同的方法。

I've been struggling with Android IAB v3 for a while now. I have it working consistently on my test devices. However, my crash reporting service shows two recurring crashes: one for null pointer exception and one for illegal state exception. I've tried updating the Google sample code w/ numerous suggestions from Stackoverflow users facing similar problems. I've gone through the "read crash reports, do research, attempt to fix crashes, submit update, see same crash reports again" cycle a few times. I think it's time for a different approach.

如果你从今天开始与Android IAB,你会选择什么作为最先进的最新的,正确的资源为code样品,修复,文档等?

此不必是单一的资源。样品code的任意组合,从SO帖子,博客文章,甚至更新了Android SDK管理器中的补丁会有所帮助。理想情况下,我们可以为乡亲新IAB是$ P $的头痛和试图整合服务斗争pvents他们的资源。

This doesn't have to be a single resource. Any combination of sample code, patches from SO posts, blog posts, or even "update with Android SDK Manager" will be helpful. Ideally, we can create a resource for folks new to IAB that prevents them from the headache and struggle of trying to integrate the service.

修改1 :上崩溃更多信息

java.lang.IllegalStateException: Can't start async operation (refresh inventory) because another async operation(launchPurchaseFlow) is in progress.
   at com.android.vending.billing.IabHelper.flagStartAsync(IabHelper.java:832)
   at com.android.vending.billing.IabHelper.queryInventoryAsync(IabHelper.java:623)
   at com.android.vending.billing.IabHelper.queryInventoryAsync(IabHelper.java:651)
   ...


java.lang.NullPointerException
   at com.android.vending.billing.IabHelper.launchPurchaseFlow(IabHelper.java:398)
   at com.android.vending.billing.IabHelper.launchPurchaseFlow(IabHelper.java:350)
   ...

这些是两个例外。他们并不总是发生在IabHelper同一个地方。我很可能只是修补他们,但似乎并没有像正确的方式来解决这个问题。此外,它并不能帮助任何人。

Those are the two exceptions. They don't always happen in the same places in IabHelper. I could probably just patch them, but that doesn't seem like the right way to solve this problem. Also, it doesn't help anyone else.

这可能是我使用的是过时的样品code形式的谷歌。不过,我已经搜查了不少,但没有找到任何东西更近一些。

It's possible that I'm using out-dated sample code form Google. However, I've searched quite a bit and couldn't find anything more recent.

推荐答案

嘿,我也正在InApp购买自10天,我已经成功地集成在我现有的应用程序,并准备进行直播。最初的时候我就开始做这个,我已经下载了谷歌InApp帐单为例称为破驱动器,从的此处。

Hey I'm also working on InApp Purchase since 10 days and I've successfully integrated in my existing app and ready to make it live. Initially when i had started doing this I've downloaded google InApp Billing Example called "Trivial Drive" from here.

但它并不能帮助我很多,因为它有很多的问题和错误,所以我决定用新V3 API,你可以找到的此处。本教程有明确的解释,这将有助于你,如果你还没有时间看此内容 YouTube视频其中,谷歌员工都清楚地解释了如何将它。

But it didn't help me much as it has lots of issues and bugs, So I've decided do it on my own from scratch using new v3 api which you can find here. This tutorial has clear explanation that would help you and also if you have time see this youtube video where google employee had explained clearly how to integrate it.

另外,如果你想简单的例子,我有一个示例应用程序,你可以从的此处。随意问,如果你有任何问题。

Also if you want quick example, I've a sample app which you can download from here. Feel free to ask if you have any questions.