android – SecurityException:使用应用内结算将Binder调用到错误的界面

android – SecurityException:使用应用内结算将Binder调用到错误的界面,第1张

概述我在尝试使用Google提供的应用内结算库时遇到了SecurityException.以下是完整的例外情况: 07-05 15:56:47.783 26481-26481/com.andrewq.planets E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.andrewq.planets, PID: 26481 java 我在尝试使用Google提供的应用内结算库时遇到了SecurityException.以下是完整的例外情况:
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.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)

这是带有第227行的IabHelper.java方法:

@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,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."));        }    }};

最后,这是IInAppBillingService.java文件,其中第208行是:

@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;}

现在,当我第一次启动我的应用程序时会发生将调试器附加到进程后,我得到了异常.

解决方法 找到我的答案( here),希望它能解决你的问题. (它是中文的,但Chrome翻译了它.) 它与客户端的.AIDL位置有关.它必须与服务器中的.AIDL文件完全相同.它必须放在客户端的src文件夹中的同名包中. 总结

以上是内存溢出为你收集整理的android – SecurityException:使用应用内结算将Binder调用到错误的界面全部内容,希望文章能够帮你解决android – SecurityException:使用应用内结算将Binder调用到错误的界面所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1137300.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存