本文介绍了谷歌应用内计费,抛出:IllegalArgumentException:服务意向一定要明确,在升级至Android大号开发preVIEW后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用内结算code的工作,直到我升级到了Android大号开发preVIEW。现在,我得到这个错误我的应用程序启动时。有谁知道有什么变化约1,导致这个或如何,我应该改变我的code,以解决这一问题?
安卓{
compileSdkVersion机器人-L'
buildToolsVersion'20'
defaultConfig {
的minSdkVersion 13
targetSdkVersion'L'
...
...
编译com.google.android.gms:播放服务:5 +'
编译com.android.support:support-v13:21.+
编译com.android.support:appcompat-v7:21.+
...
...
错误时,应用程序启动:
06-29 16:22:33.281 5719-5719 / com.tbse.wnswfree D / AndroidRuntime:关闭虚拟机
06-29 16:22:33.284 5719-5719 / com.tbse.wnswfree E / AndroidRuntime:致命异常:主要
工艺:com.tbse.wnswfree,PID:5719
java.lang.RuntimeException的:无法启动的活动ComponentInfo {com.tbse.wnswfree / com.tbse.wnswfree.InfoPanel}:java.lang.IllegalArgumentException:如果服务意向一定要明确:意向{行为= com.android.vending.billing .InAppBillingService.BIND}
在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2255)
在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2317)
在android.app.ActivityThread.access $ 800(ActivityThread.java:143)
在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1258)
在android.os.Handler.dispatchMessage(Handler.java:102)
在android.os.Looper.loop(Looper.java:135)
在android.app.ActivityThread.main(ActivityThread.java:5070)
在java.lang.reflect.Method.invoke(本机方法)
在java.lang.reflect.Method.invoke(Method.java:372)
在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:836)
在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
java.lang.IllegalArgumentException异常:由造成服务意向一定要明确:意向{行为= com.android.vending.billing.InAppBillingService.BIND}
在android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1603)
在android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1702)
在android.app.ContextImpl.bindService(ContextImpl.java:1680)
在android.content.ContextWrapper.bindService(ContextWrapper.java:528)
在com.tbse.wnswfree.util.IabHelper.startSetup(IabHelper.java:262)
在com.tbse.wnswfree.InfoPanel.onStart(InfoPanel.java:709)
在android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1217)
在android.app.Activity.performStart(Activity.java:5736)
在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2218)
在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2317)
在android.app.ActivityThread.access $ 800(ActivityThread.java:143)
在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1258)
...
709线在InfoPanel.java:
mHelper.startSetup(新IabHelper.OnIabSetupFinishedListener(){
@覆盖
公共无效onIabSetupFinished(IabResult结果){
...
解决方案
我有同样的问题,并明确设置包解决它
。类似阿列克谢的答案,但简单的:
意向意图=新的意图(com.android.vending.billing.InAppBillingService.BIND);
//这是一个固定的一切对我来说,重点线
intent.setPackage(com.android.vending);
。的getContext()bindService(意向,serviceConnection,Context.BIND_AUTO_CREATE);
My in-app billing code was working fine until I upgraded to the Android L Dev Preview. Now I get this error when my app starts. Does anyone know what's changed about L that causes this or how I should change my code to fix this?
android {
compileSdkVersion 'android-L'
buildToolsVersion '20'
defaultConfig {
minSdkVersion 13
targetSdkVersion 'L'
...
...
compile 'com.google.android.gms:play-services:5.+'
compile 'com.android.support:support-v13:21.+'
compile 'com.android.support:appcompat-v7:21.+'
...
...
The error when the app starts:
06-29 16:22:33.281 5719-5719/com.tbse.wnswfree D/AndroidRuntime﹕ Shutting down VM
06-29 16:22:33.284 5719-5719/com.tbse.wnswfree E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.tbse.wnswfree, PID: 5719
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tbse.wnswfree/com.tbse.wnswfree.InfoPanel}: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.billing.InAppBillingService.BIND }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2255)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2317)
at android.app.ActivityThread.access$800(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5070)
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:836)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.billing.InAppBillingService.BIND }
at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1603)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1702)
at android.app.ContextImpl.bindService(ContextImpl.java:1680)
at android.content.ContextWrapper.bindService(ContextWrapper.java:528)
at com.tbse.wnswfree.util.IabHelper.startSetup(IabHelper.java:262)
at com.tbse.wnswfree.InfoPanel.onStart(InfoPanel.java:709)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1217)
at android.app.Activity.performStart( Activity.java:5736)
at android.app.ActivityThread.performLaunchActivity( ActivityThread.java:2218)
at android.app.ActivityThread.handleLaunchActivity( ActivityThread.java:2317)
at android.app.ActivityThread.access$800( ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage( ActivityThread.java:1258)
...
Line 709 in InfoPanel.java:
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
@Override
public void onIabSetupFinished(IabResult result) {
...
解决方案
I had the same problem and explicitly setting the package solved it. Similar to Aleksey's answer, but simpler:
Intent intent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
// This is the key line that fixed everything for me
intent.setPackage("com.android.vending");
getContext().bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
这篇关于谷歌应用内计费,抛出:IllegalArgumentException:服务意向一定要明确,在升级至Android大号开发preVIEW后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
08-11 23:47