再接拇指玩的sdk的时候,直接用的plugin-x的基础上,调用支付,直接调用的时候没有调用起来支付窗,出现了下面的报错信息
12-04 17:42:50.783: W/dalvikvm(13683): threadid=13: uncaught exception occurred 12-04 17:42:50.784: W/System.err(13683): java.lang.IllegalArgumentException: Synchronous ResponseHandler used in AsyncHttpClient. You should create your response handler in a looper thread or use SyncHttpClient instead. 12-04 17:42:50.785: W/System.err(13683): at com.loopj.android.http.a.b(Unknown Source) 12-04 17:42:50.786: W/System.err(13683): at com.loopj.android.http.a.a(Unknown Source) 12-04 17:42:50.786: W/System.err(13683): at com.loopj.android.http.a.a(Unknown Source) 12-04 17:42:50.786: W/System.err(13683): at com.muzhiwan.sdk.core.c.h.a(Unknown Source) 12-04 17:42:50.786: W/System.err(13683): at com.muzhiwan.sdk.service.MzwService.c(Unknown Source) 12-04 17:42:50.786: W/System.err(13683): at com.muzhiwan.sdk.service.MzwService.b(Unknown Source) 12-04 17:42:50.786: W/System.err(13683): at com.muzhiwan.sdk.service.p.a(Unknown Source) 12-04 17:42:50.786: W/System.err(13683): at com.muzhiwan.sdk.service.k.onTransact(Unknown Source) 12-04 17:42:50.786: W/System.err(13683): at android.os.Binder.transact(Binder.java:310) 12-04 17:42:50.787: W/System.err(13683): at com.muzhiwan.sdk.service.IMzwService$Stub$Proxy.doPay(IMzwService.java:207) 12-04 17:42:50.787: W/System.err(13683): at com.muzhiwan.sdk.core.MzwSdkController.doPay(MzwSdkController.java:252) 12-04 17:42:50.787: W/System.err(13683): at org.cocos2dx.plugin.DynamicMZW.payForProduct(DynamicMZW.java:92) 12-04 17:42:50.787: W/System.err(13683): at org.cocos2dx.lib.Cocos2dxRenderer.nativeRender(Native Method) 12-04 17:42:50.787: W/System.err(13683): at org.cocos2dx.lib.Cocos2dxRenderer.onDrawFrame(Cocos2dxRenderer.java:87) 12-04 17:42:50.788: W/System.err(13683): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1550) 12-04 17:42:50.788: W/System.err(13683): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1263) 12-04 17:42:50.788: W/dalvikvm(13683): threadid=13: calling UncaughtExceptionHandler 12-04 17:42:50.789: W/dalvikvm(13683): threadid=13: calling UncaughtExceptionHandler done 12-04 17:42:50.789: D/dalvikvm(13683): threadid=13: bye!
然后对照了之前的把代码修改成下面的格式可以了,就是在主线程下跑,之前就算开了一个线程还是不可以
public class DynamicMZW implements DynamicAdapter { private Context mContext = null; protected static String TAG = "DynamicMZW"; private static boolean isDebug = true; private static DynamicMZW adapter = null; private MzwOrder order; protected static void LogE(String msg, Exception e) { Log.e(TAG, msg, e); e.printStackTrace(); } public DynamicMZW(Context context) { mContext = context; adapter = this; } //修改成这个 Activity activity = (Activity) mContext; activity.runOnUiThread(new Runnable() { public void run() { MzwSdkController.getInstance().doPay(order, new MzwPayCallback(){ public void onResult(final int code,MzwOrder order) { if (code == CallbackCode.SUCCESS) { String accountname = order.getAccountname(); String productdesc = order.getProductdesc(); String orderId = order.getProductid(); String productname = order.getProductname(); String extern = order.getExtern(); double money = order.getMoney(); InterfaceDynamic.onPayResult(adapter, InterfaceDynamic.PAYRESULT_SUCCESS, "支付成功"); } else { if (code == CallbackCode.ERROR) { // InterfaceDynamic.onPayResult(adapter, // InterfaceDynamic.PAYRESULT_FAIL, "支付失败"); } } } }); } });
版权属于:东哥笔记 - DongGe.org
本文链接:https://dongge.org/blog/257.html
自2017年12月26日起,『转载以及大段采集进行后续编辑』须注明本文标题和链接!否则禁止所有转载和采集行为!