SecurityException: Binder invocation to an incorrect interface using in-app billing
来源:互联网 发布:centos 配置smtp 编辑:程序博客网 时间:2024/05/22 02:26
转自stack overflow:http://stackoverflow.com/questions/24591282/securityexception-binder-invocation-to-an-incorrect-interface-using-in-app-bill
I'm getting a SecurityException when attempting to use the in-app billing library that Google offers. Here is the full exception:
07-05 15:56:47.783 26481-26481/com.andrewq.planets E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.andrewq.planets, PID: 26481 java.lang.SecurityException: Binder invocation to an incorrect interface at android.os.Parcel.readException(Parcel.java:1465) at android.os.Parcel.readException(Parcel.java:1419) at billing.IInAppBillingService$Stub$Proxy.isBillingSupported(IInAppBillingService.java:208) at com.android.vending.billing.IabHelper$1.onServiceConnected(IabHelper.java:227) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1101) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1118) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method)
Here is the IabHelper.java method with line 227:
@Override public void onServiceConnected(ComponentName name, IBinder service) { if (mDisposed) return; logDebug("Billing service connected."); mService = IInAppBillingService.Stub.asInterface(service); String packageName = mContext.getPackageName(); try { logDebug("Checking for in-app billing 3 support."); // check for in-app billing v3 support //**LINE 227** int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP); if (response != BILLING_RESPONSE_RESULT_OK) { if (listener != null) listener.onIabSetupFinished(new IabResult(response, "Error checking for billing v3 support.")); // if in-app purchases aren't supported, neither are subscriptions. mSubscriptionsSupported = false; return; } logDebug("In-app billing version 3 supported for " + packageName); // check for v3 subscriptions support response = mService.isBillingSupported(3, packageName, ITEM_TYPE_SUBS); if (response == BILLING_RESPONSE_RESULT_OK) { logDebug("Subscriptions AVAILABLE."); mSubscriptionsSupported = true; } else { logDebug("Subscriptions NOT AVAILABLE. Response: " + response); } mSetupDone = true; } catch (RemoteException e) { if (listener != null) { listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION, "RemoteException while setting up in-app billing.")); } e.printStackTrace(); return; } if (listener != null) { listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful.")); } }};
And finally, here is the IInAppBillingService.java file where line 208 is:
@Override public int isBillingSupported(int apiVersion, java.lang.String packageName, java.lang.String type) throws android.os.RemoteException{ android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); int _result; try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeInt(apiVersion); _data.writeString(packageName); _data.writeString(type); mRemote.transact(Stub.TRANSACTION_isBillingSupported, _data, _reply, 0); //**LINE 208** _reply.readException(); _result = _reply.readInt(); } finally { _reply.recycle(); _data.recycle(); } return _result;}
Now this happens when I first launch my app. I got the exception after attaching a debugger to the process.
1 Answer 1
Found my answer ( here), hope it solves yours. (It's in Chinese, but Chrome translated it.) It had to do with the location of the .AIDL on the client side. It must be an exact duplicate of the .AIDL file in the server. And it must be placed in a package of the same name in the client's src folder.
- SecurityException: Binder invocation to an incorrect interface using in-app billing
- ERROR/AndroidRuntime(716): java.lang.SecurityException: Binder invocation to an incorrect interface
- ERROR/AndroidRuntime(716): java.lang.SecurityException: Binder invocation to an incorrect interface
- java.lang.SecurityException: Binder invocation to an incorrect interface进程通信异常
- ERROR/AndroidRuntime(716): java.lang.SecurityException: Binder invocation to an incorrect interface
- java.lang.SecurityException: Binder invocation to an incorrect interface进程通信异常
- java.lang.SecurityException: Binder invocation to an incorrect interface报错问题
- java.lang.SecurityException: Binder invocation to an incorrect interface 绑定错误的接口
- android 调用远程service时报java.lang.SecurityException: Binder invocation to an incorrect interface异常
- Binder invocation to an incorrect interface 异常分析
- Google In App Billing
- In-app Billing 概述
- How To Generate An XML File As A Target Datastore Using ODI In An Integration Interface ? [ID 454268
- An Introduction to Using Binder Framework on Android Operating System
- Google Play In-app Billing
- Google Play In-app Billing
- Google Play In-app Billing
- Google Play In-app Billing
- 【Treap】[BZOJ 1208]宠物收养所
- Yii学习笔记之二(使用gii生成一个简单的例子)
- Android项目页面跳转小Demo
- STL学习笔记之空间配置器
- 黑马程序员——Foundation框架——包装类以及NSDate
- SecurityException: Binder invocation to an incorrect interface using in-app billing
- 14.1.1 小玩文件
- 第七章
- HttpURLConnection访问网络
- (2)LinuxI2C驱动--I2C总线
- LightOJ1020(博弈)
- AgileEAS.net 学习总结
- 第14周-文件的写入与读出(多例)
- easui框架搭建第二课