IAB startSetup NullPointerException

Another fine example of Googles ‘write once, let others fix our problems’. Even at this moment (June 2014) the ‘patch’ is still not in the released sdk. To solve the problem replace

 if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {

with

  PackageManager pm=mContext.getPackageManager();
  List<ResolveInfo> intentServices = pm.queryIntentServices(serviceIntent, 0);
  if (intentServices != null && !intentServices.isEmpty())

Then in the dispose code

replace

  if (mContext != null) mContext.unbindService(mServiceConn);

with

  if (mContext != null && mService!=null) mContext.unbindService(mServiceConn);

I hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *