Android Question Error with in app billing and Android 5

gadgetmonster

Active Member
Licensed User
Longtime User
Hi Erel,

I have changed my SDK to version 21 in B4a and when compiling my app I get the following error when initialising BillingManager3:

B4X:
java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.billing.InAppBillingService.BIND }
 at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674)
 at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1773)
 at android.app.ContextImpl.bindService(ContextImpl.java:1751)
 at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
 at anywheresoftware.b4a.objects.IbHelper.startSetup(IbHelper.java:268)
 at anywheresoftware.b4a.inappbilling3.BillingManager3.Initialize(BillingManager3.java:43)
 at com.theappspod.dayjournal.main._activity_create(main.java:758)
 at java.lang.reflect.Method.invoke(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:372)
 at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
 at com.theappspod.dayjournal.main.afterFirstLayout(main.java:98)
 at com.theappspod.dayjournal.main.access$100(main.java:16)
 at com.theappspod.dayjournal.main$WaitForLayout.run(main.java:76)
 at android.os.Handler.handleCallback(Handler.java:739)
 at android.os.Handler.dispatchMessage(Handler.java:95)
 at android.os.Looper.loop(Looper.java:135)
 at android.app.ActivityThread.main(ActivityThread.java:5221)
 at java.lang.reflect.Method.invoke(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:372)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.billing.InAppBillingService.BIND }

Any ideas?
 

keirS

Well-Known Member
Licensed User
Longtime User
Blame Google. They deprecated implicit intents for bindService() in Lollipop. This apparently means they broke some of their own API's. Don't target 21 is the simplest fix.
 
Upvote 0

TpS

Member
Licensed User
Longtime User
I'm receiving just about the same Error when I try to register my device to GCM:
java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.c2dm.intent.REGISTER (has extras) }
This is running in a service that registers and receives Push content.

The code is working nicely when I have set android:targetSdkVersion to 19 instead of 21.
I updated my SDK to latest 5.0.1 (API 21) Rev 2 today but still the same.

I´m running the app on a Note 3 with CM12 Android 5.0.2.

Any ideas?
I would like to add Material Design to my app, but not to the cost of push content...
 
Upvote 0

TpS

Member
Licensed User
Longtime User
Thanks!

I had the exact same code except for the two Javaobject rows, adding that made it work!
 
Upvote 0
Top