Open Apples0609 opened 8 years ago
你是怎么导入的?以 library 方式的吗?
@samurai00 Library依赖方式导入pingpp,我只导入了这个库,难道跟这个有关系??? 报错是NullPointerException,应该跟导入库没关系吧?
导入方式本身没关系。我们示例以 library 方式导入是为了避免漏导入东西。你要确保所有需要的 jar 包、assets 文件、.so 文件等等都导入才行。比如银联,除了 jar 包之外,assets 下的 data.bin 和 libs 下的 libentryexpro.so 是必须的。
@samurai00 有差东西吗? 支付宝可以成功,我也看了两个charge,银联的明显短于支付宝的,不知道是不是我们服务器给的charge有问题呢?
@samurai00 刚测了下你用你们的demo使用银联支付,使用的charge就是上边的,也是同样的错误
我这边在这个 github 的 demo 中用你的 charge 试了一下,调起正常,没有崩溃,只是提示“订单无效或已失效”。用的是 Android Studio。 Eclipse 的话,你可能需要把 /lib/pingpp/assets 目录下的 data.bin 放到 /example/assets/下。
@samurai00 按照你的提示把data.bin放在我们项目下不再崩溃,可以进入银联支付页面。 但进入银联支付页面是会报下边的警告,每次都会报:
03-23 11:42:27.714: W/System.err(13121): java.lang.SecurityException: Not allowed to bind to service Intent { act=org.simalliance.openmobileapi.service.ISmartcardService } 03-23 11:42:27.714: W/System.err(13121): at android.app.ContextImpl.bindService(ContextImpl.java:1482) 03-23 11:42:27.714: W/System.err(13121): at android.app.ContextImpl.bindService(ContextImpl.java:1453) 03-23 11:42:27.714: W/System.err(13121): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 03-23 11:42:27.718: W/System.err(13121): at org.simalliance.openmobileapi.SEService.
(SEService.java:152) 03-23 11:42:27.718: W/System.err(13121): at com.unionpay.mobile.android.utils.k. (Unknown Source) 03-23 11:42:27.718: W/System.err(13121): at com.unionpay.mobile.android.pro.views.h.t(Unknown Source) 03-23 11:42:27.718: W/System.err(13121): at com.unionpay.mobile.android.nocard.views.l. (Unknown Source) 03-23 11:42:27.718: W/System.err(13121): at com.unionpay.mobile.android.pro.views.h. (Unknown Source) 03-23 11:42:27.718: W/System.err(13121): at com.unionpay.mobile.android.pro.views.j. (Unknown Source) 03-23 11:42:27.718: W/System.err(13121): at com.unionpay.uppay.PayActivity.a(Unknown Source) 03-23 11:42:27.718: W/System.err(13121): at com.unionpay.mobile.android.plugin.BaseActivity.onCreate(Unknown Source) 03-23 11:42:27.718: W/System.err(13121): at com.unionpay.uppay.PayActivity.onCreate(Unknown Source) 03-23 11:42:27.718: W/System.err(13121): at android.app.Activity.performCreate(Activity.java:5109) 03-23 11:42:27.721: W/System.err(13121): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 03-23 11:42:27.721: W/System.err(13121): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162) 03-23 11:42:27.721: W/System.err(13121): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2248) 03-23 11:42:27.721: W/System.err(13121): at android.app.ActivityThread.access$600(ActivityThread.java:145) 03-23 11:42:27.721: W/System.err(13121): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246) 03-23 11:42:27.721: W/System.err(13121): at android.os.Handler.dispatchMessage(Handler.java:99) 03-23 11:42:27.721: W/System.err(13121): at android.os.Looper.loop(Looper.java:137) 03-23 11:42:27.721: W/System.err(13121): at android.app.ActivityThread.main(ActivityThread.java:5106) 03-23 11:42:27.721: W/System.err(13121): at java.lang.reflect.Method.invokeNative(Native Method) 03-23 11:42:27.721: W/System.err(13121): at java.lang.reflect.Method.invoke(Method.java:511) 03-23 11:42:27.721: W/System.err(13121): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) 03-23 11:42:27.721: W/System.err(13121): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:588) 03-23 11:42:27.721: W/System.err(13121): at dalvik.system.NativeStart.main(Native Method) 03-23 11:42:27.721: V/NFC(13121): this device does not have NFC support 03-23 11:42:27.764: W/ResourceType(13121): No package identifier when getting name for resource number 0x000022b8 03-23 11:42:27.821: D/dalvikvm(13121): GC_CONCURRENT freed 1716K, 16% free 13259K/15720K, paused 4ms+9ms, total 57ms 03-23 11:42:28.331: W/ResourceType(13121): No package identifier when getting name for resource number 0x000022b8 03-23 11:42:28.338: W/System.err(13121): org.json.JSONException: Index 3 out of range [0..3) 03-23 11:42:28.338: W/System.err(13121): at org.json.JSONArray.get(JSONArray.java:263) 03-23 11:42:28.338: W/System.err(13121): at org.json.JSONArray.getString(JSONArray.java:421) 03-23 11:42:28.338: W/System.err(13121): at com.unionpay.mobile.android.nocard.views.l.C(Unknown Source) 03-23 11:42:28.338: W/System.err(13121): at com.unionpay.mobile.android.nocard.views.l.D(Unknown Source) 03-23 11:42:28.338: W/System.err(13121): at com.unionpay.mobile.android.nocard.views.l.x(Unknown Source) 03-23 11:42:28.338: W/System.err(13121): at com.unionpay.mobile.android.nocard.views.l.a(Unknown Source) 03-23 11:42:28.338: W/System.err(13121): at com.unionpay.mobile.android.nocard.views.b.a(Unknown Source) 03-23 11:42:28.341: W/System.err(13121): at com.unionpay.mobile.android.nocard.utils.UPPayEngine.handleMessage(Unknown Source) 03-23 11:42:28.341: W/System.err(13121): at android.os.Handler.dispatchMessage(Handler.java:95) 03-23 11:42:28.341: W/System.err(13121): at android.os.Looper.loop(Looper.java:137) 03-23 11:42:28.341: W/System.err(13121): at android.app.ActivityThread.main(ActivityThread.java:5106) 03-23 11:42:28.341: W/System.err(13121): at java.lang.reflect.Method.invokeNative(Native Method) 03-23 11:42:28.341: W/System.err(13121): at java.lang.reflect.Method.invoke(Method.java:511) 03-23 11:42:28.341: W/System.err(13121): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) 03-23 11:42:28.341: W/System.err(13121): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:588) 03-23 11:42:28.341: W/System.err(13121): at dalvik.system.NativeStart.main(Native Method) 03-23 11:42:28.344: W/ResourceType(13121): No package identifier when getting name for resource number 0x000022b8 03-23 11:42:28.491: W/ResourceType(13121): No package identifier when getting name for resource number 0x000022b8
然后在我关闭银联支付页面时,点击左上角的叉叉,又报错了这是我的应用没有崩溃,错误log:
03-23 11:43:25.832: E/ActivityThread(13121): Activity com.unionpay.uppay.PayActivity has leaked ServiceConnection com.unionpay.mobile.android.pboctransaction.samsung.d@41761110 that was originally bound here 03-23 11:43:25.832: E/ActivityThread(13121): android.app.ServiceConnectionLeaked: Activity com.unionpay.uppay.PayActivity has leaked ServiceConnection com.unionpay.mobile.android.pboctransaction.samsung.d@41761110 that was originally bound here 03-23 11:43:25.832: E/ActivityThread(13121): at android.app.LoadedApk$ServiceDispatcher.
(LoadedApk.java:981) 03-23 11:43:25.832: E/ActivityThread(13121): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:875) 03-23 11:43:25.832: E/ActivityThread(13121): at android.app.ContextImpl.bindService(ContextImpl.java:1464) 03-23 11:43:25.832: E/ActivityThread(13121): at android.app.ContextImpl.bindService(ContextImpl.java:1453) 03-23 11:43:25.832: E/ActivityThread(13121): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 03-23 11:43:25.832: E/ActivityThread(13121): at com.unionpay.mobile.android.pboctransaction.samsung.b.a(Unknown Source) 03-23 11:43:25.832: E/ActivityThread(13121): at com.unionpay.mobile.android.pro.pboc.engine.b.a(Unknown Source) 03-23 11:43:25.832: E/ActivityThread(13121): at com.unionpay.mobile.android.pro.pboc.engine.b.handleMessage(Unknown Source) 03-23 11:43:25.832: E/ActivityThread(13121): at android.os.Handler.dispatchMessage(Handler.java:95) 03-23 11:43:25.832: E/ActivityThread(13121): at android.os.Looper.loop(Looper.java:137) 03-23 11:43:25.832: E/ActivityThread(13121): at android.app.ActivityThread.main(ActivityThread.java:5106) 03-23 11:43:25.832: E/ActivityThread(13121): at java.lang.reflect.Method.invokeNative(Native Method) 03-23 11:43:25.832: E/ActivityThread(13121): at java.lang.reflect.Method.invoke(Method.java:511) 03-23 11:43:25.832: E/ActivityThread(13121): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) 03-23 11:43:25.832: E/ActivityThread(13121): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:588) 03-23 11:43:25.832: E/ActivityThread(13121): at dalvik.system.NativeStart.main(Native Method) 03-23 11:43:25.838: E/ActivityThread(13121): Activity com.unionpay.uppay.PayActivity has leaked ServiceConnection org.simalliance.openmobileapi.SEService$2@4197f8f8 that was originally bound here 03-23 11:43:25.838: E/ActivityThread(13121): android.app.ServiceConnectionLeaked: Activity com.unionpay.uppay.PayActivity has leaked ServiceConnection org.simalliance.openmobileapi.SEService$2@4197f8f8 that was originally bound here 03-23 11:43:25.838: E/ActivityThread(13121): at android.app.LoadedApk$ServiceDispatcher. (LoadedApk.java:981) 03-23 11:43:25.838: E/ActivityThread(13121): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:875) 03-23 11:43:25.838: E/ActivityThread(13121): at android.app.ContextImpl.bindService(ContextImpl.java:1464) 03-23 11:43:25.838: E/ActivityThread(13121): at android.app.ContextImpl.bindService(ContextImpl.java:1453) 03-23 11:43:25.838: E/ActivityThread(13121): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 03-23 11:43:25.838: E/ActivityThread(13121): at org.simalliance.openmobileapi.SEService. (SEService.java:152) 03-23 11:43:25.838: E/ActivityThread(13121): at com.unionpay.mobile.android.utils.k. (Unknown Source) 03-23 11:43:25.838: E/ActivityThread(13121): at com.unionpay.mobile.android.pro.views.h.t(Unknown Source) 03-23 11:43:25.838: E/ActivityThread(13121): at com.unionpay.mobile.android.nocard.views.l. (Unknown Source) 03-23 11:43:25.838: E/ActivityThread(13121): at com.unionpay.mobile.android.pro.views.h. (Unknown Source) 03-23 11:43:25.838: E/ActivityThread(13121): at com.unionpay.mobile.android.pro.views.j. (Unknown Source) 03-23 11:43:25.838: E/ActivityThread(13121): at com.unionpay.uppay.PayActivity.a(Unknown Source) 03-23 11:43:25.838: E/ActivityThread(13121): at com.unionpay.mobile.android.plugin.BaseActivity.onCreate(Unknown Source) 03-23 11:43:25.838: E/ActivityThread(13121): at com.unionpay.uppay.PayActivity.onCreate(Unknown Source) 03-23 11:43:25.838: E/ActivityThread(13121): at android.app.Activity.performCreate(Activity.java:5109) 03-23 11:43:25.838: E/ActivityThread(13121): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 03-23 11:43:25.838: E/ActivityThread(13121): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162) 03-23 11:43:25.838: E/ActivityThread(13121): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2248) 03-23 11:43:25.838: E/ActivityThread(13121): at android.app.ActivityThread.access$600(ActivityThread.java:145) 03-23 11:43:25.838: E/ActivityThread(13121): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246) 03-23 11:43:25.838: E/ActivityThread(13121): at android.os.Handler.dispatchMessage(Handler.java:99) 03-23 11:43:25.838: E/ActivityThread(13121): at android.os.Looper.loop(Looper.java:137) 03-23 11:43:25.838: E/ActivityThread(13121): at android.app.ActivityThread.main(ActivityThread.java:5106) 03-23 11:43:25.838: E/ActivityThread(13121): at java.lang.reflect.Method.invokeNative(Native Method) 03-23 11:43:25.838: E/ActivityThread(13121): at java.lang.reflect.Method.invoke(Method.java:511) 03-23 11:43:25.838: E/ActivityThread(13121): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) 03-23 11:43:25.838: E/ActivityThread(13121): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:588) 03-23 11:43:25.838: E/ActivityThread(13121): at dalvik.system.NativeStart.main(Native Method)
请尽快解决一下,虽然我们应用没有崩溃,但是存在潜在的隐患,若是上线支付时崩溃掉,这可真就不好了。。。。
这个是银联提供的插件的一个“问题”,他们要求使用 Open Mobile API 来构建项目,否则就会报这个错。你要去掉这个错的话,可以下载这个 http://pan.baidu.com/s/1o73HCwU
@samurai00 按照这个方法把 addon-open_mobile_api-giesecke_devrient_gmbh-19 文件夹放在 sdk的add-ons 文件夹下边,重新运行上边的警告、报错依然存在,是不是我需要在项目中加入代码还是怎么做呢?
放好之后,有选择这个来 build 吗?项目配置里
@samurai00 我用的eclipse,放好以后,我重启了eclipse,然后clean所有项目以及build all,运行项目问题还是存在,不清楚你所说的“选择这个来buil”,百度网盘下载的指示只说了放在add-ons下边,并没有别的操作,麻烦你告诉还要做怎么谢谢!
如图:
我们的项目是建立在5.0就是21以上sdk,若是选择了 Open Mobile API 4.4,我们项目的依赖库appcompat_v7就是就会报错不能编译,有没有 Open Mobile API 5,0以上的呢?
@samurai00
@samurai00 我把appcompat_v7错误values都删除了,现在项目可以正常运行,也使用了Open Mobile API 4.4编译,pingpp库以及appcompat_v7和我们项目均使用了Open Mobile API 4.4编译,但问题还是存在的。警告,报错都在的,,,
我也出现了同样的问题,这个怎么完美解决,求解
@LuoGuoXin 没解决,他们说的方法解决不了,也不理人了,应用不崩溃就没管了
https://github.com/seek-for-android/pool/wiki/UsingSmartCardAPI#setting-up-the-environment 你们按照这个 步骤 安装 Open Mobile API 21 的试试。
崩溃Log:
charge信息: { "charge":"{"id":"ch_nDaX5814WTGO4OmLSGGuzvvL","object":"charge","created":1458642689,"livemode":true,"paid":false,"refunded":false,"app":"app_aDqPO88ebzbL0OOy","channel":"upacp","orderNo":"12345678","clientIp":"127.0.0.1","amount":12300,"amountSettle":12300,"currency":"cny","subject":"机票","body":"机票","timeExpire":1458646289,"refunds":{"object":"list","url":"/v1/charges/ch_nDaX5814WTGO4OmLSGGuzvvL/refunds","hasMore":false,"data":[]},"amountRefunded":0,"metadata":{},"credential":{"object":"credential","upacp":{"tn":"201603221811119348378","mode":"00"}},"extra":{}}" }
请尽快回复,谢谢!
一套调用方式,支付宝正常! 支付宝charge: { "charge":"{"id":"ch_9KuTuPH0yzXDq54WjTPSSm9K","object":"charge","created":1458642640,"livemode":true,"paid":false,"refunded":false,"app":"app_aDqPO88ebzbL0OOy","channel":"alipay","orderNo":"12345678","clientIp":"127.0.0.1","amount":12300,"amountSettle":12300,"currency":"cny","subject":"机票","body":"机票","timeExpire":1458729040,"refunds":{"object":"list","url":"/v1/charges/ch_9KuTuPH0yzXDq54WjTPSSm9K/refunds","hasMore":false,"data":[]},"amountRefunded":0,"metadata":{},"credential":{"object":"credential","alipay":{"orderInfo":"service\u003d\"mobile.securitypay.pay\"\u0026_input_charset\u003d\"utf-8\"\u0026notify_url\u003d\"https%3A%2F%2Fapi.pingxx.com%2Fnotify%2Fcharges%2Fch_9KuTuPH0yzXDq54WjTPSSm9K\"\u0026partner\u003d\"2088121009223318\"\u0026out_trade_no\u003d\"12345678\"\u0026subject\u003d\"机票\"\u0026body\u003d\"机票\"\u0026total_fee\u003d\"123.00\"\u0026payment_type\u003d\"1\"\u0026seller_id\u003d\"2088121009223318\"\u0026it_b_pay\u003d\"2016-03-23 18:30:40\"\u0026sign\u003d\"XCsj37UC4V7aD1D%2BCE1NDJqJqtZYY1TCJQ%2FfhjqBk8Kqj0jTZfm7LTNluYdPAzBeNq0Yg7Gij2FAulIXzyTmDraHtLQMUrknHJE5Zp%2BB5RtqTL72V4cIo52inFhhngwcC0Jy8WVTdAOuV7%2F0RfXShuo5RzndaoPlps7EBItMEJE%3D\"\u0026sign_type\u003d\"RSA\""}},"extra":{}}" }