Skip to content Skip to sidebar Skip to footer

Java.lang.nullpointerexception At Iabhelper.startsetup(iabhelper.java:266)

Anyone know how to fix this NullPointerException on the start of setup of the IabHelper? java.lang.NullPointerException at android.app.ApplicationPackageManager.queryInte

Solution 1:

Do you have the code to the method queryIntentServicesAsUser()? After taking a closer look, it seems like one of the variables you are sending the queryIntentServices could be causing the NullPointer.

Solution 2:

So finally what is the right way to fix this problem? serviceIntent is null - that means someone wants to hack? And we let app crash in this situation?

Solution 3:

I finally found a user getting a null intent who was not doing anything dodgy with in-app purchases. He was on kitkat. The fix was this:

if (OSUtils.lollipopOrHigher) {
            serviceIntent = getExplicitIapIntent();
        } else {
            serviceIntent = newIntent("com.android.vending.billing.InAppBillingService.BIND");
            serviceIntent.setPackage("com.android.vending");
        }

Another option would be to check for null and then try the non lollipop method.

Post a Comment for "Java.lang.nullpointerexception At Iabhelper.startsetup(iabhelper.java:266)"