Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In-app billing (v3) - IllegalArgumentException: Service not registered:

I have just released an app with in-app billing. So far no crashes have been reported to google play (this only happens when the user takes the trouble to report the crash) but I do have some reports of crashes via flurry (which is automatic). The crash reports are as follows:

class java.lang.RuntimeException Msg: android.app.ActivityThread.performDestroyActivity:3655 (Unable to destroy activity {com.mycompany.mygame/com.mycompany.mygame.Splashscreen}: java.lang.IllegalArgumentException: Service not registered: com.mycompany.mygame.util.IabHelper$1@46369b38) 

This only happens on < 1% of executions of my app.

Correct me if I'm wrong, but it appears that the line number of the crash is not given in the flurry report :-(

I'm not even sure what this crash report means, let alone how to fix it. Any ideas?

like image 917
Mick Avatar asked Mar 27 '13 11:03

Mick


1 Answers

I believe this is a bug in IabHelper.java.

In IabHelper dispose method, the following line,

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

should be changed to this.

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

mService is only set once the Service has been registered, so checking it for != null will guarantee that service is indeed registered, before we try to unbind from it.

like image 167
therealsachin Avatar answered Sep 26 '22 03:09

therealsachin