【发布时间】:2014-08-13 06:54:34
【问题描述】:
我在测试 In App Billing 时遇到了一个非常奇怪的问题。该应用程序仅在三星标签 10.1 中崩溃,并显示以下错误消息,我完全不知道它有什么问题:
java.lang.IllegalArgumentException: com.d.b.a.b: Bad Base64 input character at 0: 5(decimal)
at com.test.iab.util.Security.verifyPurchase() at com.test.iab.util.Security.verifyPurchase() at com.test.iab.util.IabHelper.enableDebugLogging() at com.test.iab.util.IabHelper.enableDebugLogging() at com.test.iab.util.IabHelper.enableDebugLogging() at com.test.iab.util.IabHelper$2.run() at java.lang.Thread.run(Thread.java:856) Caused by: com.d.b.a.b: Bad Base64 input character at 0: 5(decimal) at com.test.iab.util.Base64.decode4to3() at com.test.iab.util.Base64.decode4to3() at com.test.iab.util.Base64.decode4to3() at com.test.iab.util.Security.verifyPurchase() at com.test.iab.util.Security.verifyPurchase() at com.test.iab.util.IabHelper.enableDebugLogging() at com.test.iab.util.IabHelper.enableDebugLogging() at com.test.iab.util.IabHelper.enableDebugLogging() at com.test.iab.util.IabHelper$2.run() at java.lang.Thread.run(Thread.java:856)
该应用程序在 Samsung S4、HTC one 和其他一些设备上运行良好,但仅在 Samsung tab 10.1 中崩溃。有没有人遇到过同样的问题?之所以在这里问,是因为我没有三星平板调试。
编辑:
我没有发布源代码的原因是因为源代码来自谷歌,我不知道究竟是哪个代码导致了问题。无论如何这里是可能与问题相关的代码:
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) {
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) ||
TextUtils.isEmpty(signature)) {
Log.e(TAG, "Purchase verification failed: missing data.");
return false;
}
PublicKey key = Security.generatePublicKey(base64PublicKey);
return Security.verify(key, signedData, signature);
}
【问题讨论】:
-
你确定是设备而不是安卓版本(KitKat)?
-
你能添加崩溃代码的sn-ps吗?指向代码行?
-
没有人遇到过这种问题?