Skip to content
This repository has been archived by the owner on Oct 19, 2020. It is now read-only.

Dozens of NullPointerException Errors every day #168

Open
Marcophono2 opened this issue Aug 21, 2017 · 21 comments
Open

Dozens of NullPointerException Errors every day #168

Marcophono2 opened this issue Aug 21, 2017 · 21 comments
Assignees
Labels

Comments

@Marcophono2
Copy link

Hello!
My Cordova app (including Crosswalk plugin) is live in the Google Store. I changed out the IAB plugin a few weeks ago due to too many errors in the purchase process. But this plugin seems to have the same or similar problems. Every day I find in the ANRS&crashes section of my developer account dozens of crash reports every day. The same errors were reported here some times in the past but never got a response. I am really wondering how the most important plugin a Cordova app can have - finally being paid for the hard work of creating an app via the IAB plugin - can still contain so serious bugs which were completely ignored. Anyway, for me it is essential to fix this issue. Of course I'll pay for that job. Is there someone interested? I hope I do not touch any board rules here asking for a programmer..
I cannot test it out on my own device. I never catch an error.
Here are some of the catched errors from my Google developer account:

Samsung Galaxy Xcover3 (xcover3lte), 1536MB RAM, Android 5.1
java.lang.NullPointerException:
at com.alexdisler.inapppurchases.IabHelper.queryPurchases (IabHelper.java:849)
at com.alexdisler.inapppurchases.IabHelper.queryInventory (IabHelper.java:571)
at com.alexdisler.inapppurchases.IabHelper.queryInventory (IabHelper.java:535)
at com.alexdisler.inapppurchases.IabHelper$2.run (IabHelper.java:630)
at java.lang.Thread.run (Thread.java:818)

Samsung Galaxy S5 mini (kminilte), 1536MB RAM, Android 6.0
java.lang.NullPointerException:
at com.alexdisler.inapppurchases.IabHelper.queryPurchases (IabHelper.java:849)
at com.alexdisler.inapppurchases.IabHelper.queryInventory (IabHelper.java:571)
at com.alexdisler.inapppurchases.IabHelper.queryInventory (IabHelper.java:535)
at com.alexdisler.inapppurchases.IabHelper$2.run (IabHelper.java:630)
at java.lang.Thread.run (Thread.java:818)

Samsung Galaxy S7 (herolte), 4096MB RAM, Android 7.0
java.lang.NullPointerException:
at com.alexdisler.inapppurchases.IabHelper.queryPurchases (IabHelper.java:849)
at com.alexdisler.inapppurchases.IabHelper.queryInventory (IabHelper.java:571)
at com.alexdisler.inapppurchases.IabHelper.queryInventory (IabHelper.java:535)
at com.alexdisler.inapppurchases.IabHelper$2.run (IabHelper.java:630)
at java.lang.Thread.run (Thread.java:762)

[...]

Best regards
Marc

@moritzgloeckl
Copy link
Collaborator

Hi there,

this is a much bigger issue than what you're describing here. There are dozens of people having these problems, as it's not a problem with this inapppurchase library, but with the Google IabHelper (which has been developed by Google).

Just look into this Stackoverflow Question to see that there's a lot of complaining going on.

Currently I'm experimenting with InAppBillingV6 maybe I'll update it here too, once I've done enough testing. Would you be interested to test it too?

Regarding the asking for a programmer, it's not a problem at all, you may also openly post a bounty on BountySource so others can also look into this if you like.

Cheers
Moritz

@Marcophono2
Copy link
Author

Thank you, Moritz!
I wasn't sure if I'll receive such a nice answer due to my angry expressed post but you made my day!
Yes, I am happy if I can help you testing your code. I have 100,000 active app users. THEY will test it for you.
Aside from that: Is there no other way to use an IAB plugin for Cordova which is not basing on that buggy Google code from 2012?
Also I wrote an email to Trevor Johns, the developer of that java code asking him if he really things that the bugs are all fixed. He is not responsible for anything but should tell the truth if someone asks him. An IAB plugin is not a nice to have plugin. It is essential for surviving for indie developers who code in Cordova.

Best regards from Dortmund ;-)
Marc

@Marcophono2
Copy link
Author

Hi Moritz!
Good news! Trevor answered my email. He was surprised about the dimensions of the buggy IabHelper.java and offered to fix the code. He asked for a link to get a good overview of all symptomics. Can you provide me with such a link? I also know a lot of threads but Idon't have the overview which posted issues on different threads are basing on the same bug and also I think most of each posted issues are not complete. May be you know where a good issue tracker or thread to find regarding the IabHelper trouble?

Best regards
Marc

@moritzgloeckl
Copy link
Collaborator

Hi Marc!

Nice! It would be cool to have someone look over the code. I don't have a link of all symptoms unfortunately other than the issues posted here. There's another plugin for cordova in app purchases I'll see if they do it better than we are currently.

If you find out anything I'm very happy to work together to fix these issues.

Thank you very much and kind regards from Austria ;-)

Moritz

@nilebma
Copy link

nilebma commented Aug 25, 2017

I get the same errors reported in my crash reporting tool from time to time (affects less than 1% of total users, most of are not buyers though).

@moritzgloeckl
Copy link
Collaborator

@nilebma @Marcophono2

I've created a testing branch, I'll implement the fix suggest on the Stackoverflow Question I linked above,

Catching nullpointer in IabHelper appears to have stopped this problem. I am no longer seeing the exceptions being thrown, I'm going to accept this as an answer.

could you two guys test it please and keep us updated here if you notice anything?

@moritzgloeckl moritzgloeckl self-assigned this Aug 25, 2017
@fierysolid
Copy link

Noticing this issue as well, anyone have any quick work arounds?

@bshafiee
Copy link

Hey guys,
So I was just doing some research about picking a plugin for inAppPurchases and checked out the one from j3k0 and this one too. I looked out issues and got curious about this one. It seems like those guys have already patched the iabHelper.java j3k0/cordova-plugin-purchase@429fcdb#diff-75186e7bea31c3bcec3cb64c72545e18
So I assume you can simply catch that exception too and this should solve the problem. However, both plugins use IABHelper which is absolutely old and deprecated :( I wish if there was plan to upgrade to newer iab client from android sdk.

@moritzgloeckl
Copy link
Collaborator

@bshafiee If you like you can send us a PR!

@FiveHundredMiles
Copy link

I am seeing the same error message from my Google developer account.
Is the comment from RainerAppel posted on Sep 5 considered a workaround? Or what is the best way to fix this?
Thank you.

@sbat
Copy link

sbat commented Nov 25, 2017

I see the same error in the Google Play Console:

java.lang.NullPointerException
com.alexdisler.inapppurchases.IabHelper.queryPurchases
at com.alexdisler.inapppurchases.IabHelper.queryPurchases (IabHelper.java:849)
at com.alexdisler.inapppurchases.IabHelper.queryInventory (IabHelper.java:571)
at com.alexdisler.inapppurchases.IabHelper.queryInventory (IabHelper.java:535)
at com.alexdisler.inapppurchases.IabHelper$2.run (IabHelper.java:630)
at java.lang.Thread.run (Thread.java:818)

@Marcophono2 @moritzgloeckl @nilebma @RainerAppel @fierysolid @bshafiee @FiveHundredMiles how did you solved it? Thank you very much!

@RainerAppel
Copy link

RainerAppel commented Jan 5, 2018

I deleted my comment posted on Sep 5 because this did not work.

Currently I still have no solution for this. I tried with a patched version of IabHelper.java but no success so far.

Note: You can't just patch plugins/cordova-plugin-inapppurchase/src/android/IabHelper.java because cordova seems to replace it with the original on every build.

@oangelo
Copy link

oangelo commented Jan 12, 2018

Any news about this issue? We should resolve this. Since Google uses the number of errors to rank the apps, this problem might give us a bad rank position, that implies less users, and thus, less revenue.

@RainerAppel
Copy link

I think I have finallly fixed this issue. Catching all those NullPointerExceptions at least avoids the crashes.
Here ist the pull request:
#208

@gpaslari
Copy link

Guys, please add a message here, when you merge this PR. Having the same issue.
Thanks!

@Risingson
Copy link
Contributor

Risingson commented May 23, 2018

Will these exceptions get avoided in this repo ?

@ibnclaudius
Copy link

I'm algo facing the same problem. Dozens of crash everyday.

screen shot 2018-08-27 at 4 17 13 pm
screen shot 2018-08-27 at 4 17 28 pm

@heavengames
Copy link

So throwing the error appears to mean that it just fixes the crash reporting, but failed purchases still occur because the source issue (objects being dumped from memory) is still happening.

Am I correct in believing that throwing the exception still means purchases will fail? I have been unable to replicate the issue so cannot confirm/deny the latter question. If that is the case, how does one ensure that the objects don't get dumped and if they do they get reinitialized?

@francois-dibulo
Copy link

We too get this error quite frequently and a lot of complains from the users that the app crashes.

Since I can't reproduce it, has anyone tried the bugfix from ghenry22 and can confirm that the error is not just "caught" but also the purchase works?!

Thank you!

@fierysolid
Copy link

Switch to react-native and never look back haha

@oangelo
Copy link

oangelo commented Jun 17, 2019

@francois-n-dream, I can confirm that the pull request from @RainerAppel works, the error is "caught" and the purchase works. BUT, it is better to update to Ionic 4 as soon as possible.

epetre added a commit to epetre/cordova-plugin-inapppurchase that referenced this issue May 20, 2020
It seems that IabHelper is an old implementation and is not properly garbadge collected.
I don't have time to investigate, but crashing because of this is not needed. The typical described behavior seems to be that users view the products, go elsewhere and it crashes several seconds after when it's being garbage collected or something.
I plan on switching to j3k because the maintainers of this plugin are not active anymore, but this should at least reduce the crashes for now. 

REFs:
https://stackoverflow.com/questions/15456434/billing-api-v3-iabhelper-nullpointerexception
AlexDisler#129
AlexDisler#168
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests