Closed Lakedaemon closed 9 years ago
Duplicate #415
@Lakedaemon we already have a similar issue, but no idea how to fix it.. in the library we use only explicit intents
It's a bug in code :) Even if all my previous patches were not merged and discussed the cause is simple.
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 ....
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.
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 :)
Simple example of things that does not work as the docs says : https://github.com/onepf/OpenIAB/commit/0ca10de1eed039aaf81c198b0a817b28a829ebfd
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.
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.
Potential NPE you've mentioned should be fixed now. I'm closing this as a duplicate of #415
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)