转载地址:https://stackoverflow.com/questions/24480069/google-in-app-billing-illegalargumentexception-service-intent-must-be-explicit
现象描述:IllegalArgumentException: Service Intent must be explicit: Intent
原因:android L 在进行远程服务注册时更改了方法
I was getting the same error from older Google Cloud Messaging setup code. The simplest fix appears to be changing
private Intent getExplicitIapIntent() { PackageManager pm = mContext.getPackageManager(); Intent implicitIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND"); List<ResolveInfo> resolveInfos = pm.queryIntentServices(implicitIntent, 0); // Is somebody else trying to intercept our IAP call? if (resolveInfos == null || resolveInfos.size() != 1) { return null; } ResolveInfo serviceInfo = resolveInfos.get(0); String packageName = serviceInfo.serviceInfo.packageName; String className = serviceInfo.serviceInfo.name; ComponentName component = new ComponentName(packageName, className); Intent iapIntent = new Intent(); iapIntent.setComponent(component); return iapIntent; }其中"com.android.vending.billing.InAppBillingService.BIND"为Service 在AndroidManifest.xml 的Action值
本文详细介绍了在Android L更新后遇到的关于In-App Billing服务调用出现的非法参数异常问题,并提供了一个简单的修复方案。通过修改服务绑定的Intent使其显式指定,避免了异常的产生。
3892

被折叠的 条评论
为什么被折叠?



