Android应用内购买流程中断

时间:2013-07-08 06:30:18

标签: android

我正在尝试在我的应用中制作应用内购买流程。我使用http://developer.android.com/training/in-app-billing/preparing-iab-app.html的助手类(IabHelper等)。一切都很好,直到我付款。返回活动时,会引发此异常

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null,
request=10001, result=-1, data=Intent { (has extras) }} to activity
{com.sunlight.mangomonitor/com.sunlight.mangomonitor.PurchaseActivity}:
java.lang.IllegalArgumentException: java.security.spec.InvalidKeySpecException:
java.lang.RuntimeException: error:0D07209B:asn1 encoding routines:ASN1_get_object:too long
at android.app.ActivityThread.deliverResults(ActivityThread.java:3408)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3451)
at android.app.ActivityThread.access$1200(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1332)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5296)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: java.security.spec.InvalidKeySpecException:
java.lang.RuntimeException: error:0D07209B:asn1 encoding routines:ASN1_get_object:too long
at com.sunlight.mangomonitor.util.Security.generatePublicKey(Security.java:92)
at com.sunlight.mangomonitor.util.Security.verifyPurchase(Security.java:66)
at com.sunlight.mangomonitor.util.IabHelper.handleActivityResult(IabHelper.java:460)
at com.sunlight.mangomonitor.PurchaseActivity.onActivityResult(PurchaseActivity.java:145)
at android.app.Activity.dispatchActivityResult(Activity.java:5444)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3404)
... 11 more
Caused by: java.security.spec.InvalidKeySpecException: java.lang.RuntimeException:
error:0D07209B:asn1 encoding routines:ASN1_get_object:too long
at
org.apache.harmony.xnet.provider.jsse.OpenSSLRSAKeyFactory.engineGeneratePublic(OpenSSLRSAKeyF    actory.java:52)
at java.security.KeyFactory.generatePublic(KeyFactory.java:171)
at com.sunlight.mangomonitor.util.Security.generatePublicKey(Security.java:87)
... 16 more
Caused by: java.lang.RuntimeException: error:0D07209B:asn1 encoding
routines:ASN1_get_object:too long
at org.apache.harmony.xnet.provider.jsse.NativeCrypto.d2i_PUBKEY(Native Method)
at org.apache.harmony.xnet.provider.jsse.OpenSSLRSAKeyFactory.engineGeneratePublic(OpenSSLRSAKeyfactory.java:48)

我发现开始购买的活动可能会被破坏,在这种情况下该怎么办? 有什么建议吗?

1 个答案:

答案 0 :(得分:0)

使用针对结果概念的调用活动来调用该购买活动。使用onActivityResult()RESULT_OK检查RESULT_CANCELLED处的结果是否有效,以便您了解。