为了账号安全,请及时绑定邮箱和手机立即绑定

Google应用内结算,IllegalArgumentException

Google应用内结算,IllegalArgumentException

饮歌长啸 2019-10-09 15:07:10
在升级到Android L Dev Preview之前,我的应用内结算代码运行良好。现在,当我的应用启动时,我会收到此错误。谁知道L导致此的更改或我应该如何更改代码以解决此问题?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.+'......应用启动时的错误:06-29 16:22:33.281    5719-5719/com.tbse.wnswfree D/AndroidRuntime﹕ Shutting down VM06-29 16:22:33.284    5719-5719/com.tbse.wnswfree E/AndroidRuntime﹕ FATAL EXCEPTION: mainProcess: com.tbse.wnswfree, PID: 5719java.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 }      ...           InfoPanel.java中的709行:        mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {          @Override          public void onIabSetupFinished(IabResult result) {            ...
查看完整描述

3 回答

?
侃侃无极

TA贡献2051条经验 获得超10个赞

我遇到了同样的问题,并明确设置了程序包就解决了。与Aleksey的答案类似,但更简单:


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);


查看完整回答
反对 回复 2019-10-09
  • 3 回答
  • 0 关注
  • 545 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信