1

So all of my apps are getting this exception when they run on 5.0. . .

java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }

After googling around I find that this is caused by a bug in Google Licensing code in LicenseChecker.java but the suggested changes are all a little different so I'm not sure what to do. And it blows me away that we are supposed to make mods to Googles code.

The suspect code in my LicenseChecker.java is ...

        Log.i(TAG, "Binding to licensing service.");
        try {
            boolean bindResult = mContext
                    .bindService(
                            new Intent(
                                    new String(
                                            Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U="))),
                            this, // ServiceConnection.
                            Context.BIND_AUTO_CREATE);

We are supposed to add

serviceIntent.setPackage("com.android.vending");

somewhere in that code.

So my questions are (1) is this really the fix? and (2) if so, what exactly should the modified code look like? Thanks, Dean

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
Dean Blakely
  • 3,535
  • 11
  • 51
  • 83
  • possible duplicate of [Google In-App billing, IllegalArgumentException: Service Intent must be explicit, after upgrading to Android L Dev Preview](http://stackoverflow.com/questions/24480069/google-in-app-billing-illegalargumentexception-service-intent-must-be-explicit) – rds Aug 14 '15 at 18:49

1 Answers1

6

is this really the fix?

setPackage() is sufficient to get past the implicit-Intent limitation on API Level 21+. Whether that is the right package, I cannot say.

what exactly should the modified code look like?

Replace:

new Intent(new String(Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")))

with:

new Intent(new String(Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")))
  .setPackage("com.android.vending")
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thank you, I lost in this problem. – ferdiado Apr 11 '15 at 23:07
  • CommonsWare, That worked. Thanks. Why would Google do something like this? And then not fix it? – Dean Blakely Apr 15 '15 at 23:48
  • @DeanBlakely: "Why would Google do something like this?" -- because service security has issues. See http://commonsware.com/blog/2013/09/26/android-exported-service-mitm-attacks.html and http://commonsware.com/blog/2014/06/29/dealing-deprecations-bindservice.html. "And then not fix it?" -- they probably will at some point, by wrapping the `bindService()` call in their own API that you would get to from the Play Services SDK. I cannot speculate as to why they have not done that just yet. – CommonsWare Apr 15 '15 at 23:54