Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

explicit intent exception : Android 5.0 with Google play with openIAB 0.9.8.3.1 #449

Closed
Lakedaemon opened this issue Feb 10, 2015 · 8 comments
Assignees

Comments

@Lakedaemon
Copy link

Today, I got this crash report :

java.lang.IllegalArgumentException
:Service Intent must be explicit
:Intent { act=com.android.vending.billing.InAppBillingService.BIND }
at android.app.ContextImpl.validateServiceIntent (ContextImpl.java : 2039)
at android.app.ContextImpl.bindServiceCommon (ContextImpl.java : 2147)
at android.app.ContextImpl.bindService (ContextImpl.java : 2125)
at android.content.ContextWrapper.bindService (ContextWrapper.java : 559)
at org.onepf.oms.appstore.GooglePlay.isBillingAvailable (GooglePlay.java : 134)
at org.onepf.oms.OpenIabHelper$12.run (OpenIabHelper.java : 815)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java : 1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java : 587)
at java.lang.Thread.run (Thread.java : 818)

The user was on Android 5.0
Device : Samsung SM-N9005 hltezh

I'm building with compile files('libs/openiab-0.9.8.3.1.jar')
(this looks like a google issue as openiab is supposed to only wrap Google iAP api)

@RomanZhilich
Copy link
Collaborator

Duplicate #415

@akarimova
Copy link
Contributor

@Lakedaemon
we already have a similar issue, but no idea how to fix it..
in the library we use only explicit intents

@Tolriq
Copy link

Tolriq commented Feb 10, 2015

It's a bug in code :) Even if all my previous patches were not merged and discussed the cause is simple.

https://github.com/onepf/OpenIAB/blob/master/library/src/main/java/org/onepf/oms/appstore/GooglePlay.java#L100

You check for the non presence of both ANDROID_INSTALLER and GOOGLE_INSTALLER then in code the explicit intent is forced to ANDROID_INSTALLER.

Meaning that if GOOGLE_INSTALLER is present and not ANDROID_INSTALLER you have the crash ....

@RomanZhilich
Copy link
Collaborator

I don't see how it can cause crash.
Before sending intent we check that there's a service to handle it: https://github.com/onepf/OpenIAB/blob/master/library/src/main/java/org/onepf/oms/appstore/GooglePlay.java#L109
Intent with package considered explicit: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.2_r1/android/app/ContextImpl.java#1672

Moreover, I've tried to change this part to use Intent with ComponentInfo constructed from ResolveInfo with no luck.

@Tolriq
Copy link

Tolriq commented Feb 10, 2015

Well surely one of the many Android bugs that needs adjustment from code that should work, to workaround or try catch so that it really works :)

@Tolriq
Copy link

Tolriq commented Feb 10, 2015

Simple example of things that does not work as the docs says : 0ca10de

final List<ResolveInfo> infos = getPackageManager().queryIntentServices(intent, 0);
if (infos.isEmpty()) {

Despite the docs that says that queryIntentServices returns empty list on many devices 2.X and some other it will return null meaning crash.

@RomanZhilich
Copy link
Collaborator

We do not call isEmpty() directly, we use NPE safe util method:

CollectionUtils.isEmpty(infoList)

UPD: Oh, sorry, I get it. We'll fix this one just to be safe.

@RomanZhilich
Copy link
Collaborator

Potential NPE you've mentioned should be fixed now.
I'm closing this as a duplicate of #415

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants