android - Proguard 与应用内购买 "Duplicate zip entry"错误

标签 android in-app-purchase proguard in-app-billing

我正在使用包含文件的应用内计费(按照developer.android.com执行步骤) InAppBillingService.aidl

按照此处的建议 -> http://developer.android.com/google/play/billing/billing_best_practices.html 出于安全原因,我们需要使用 Progaurd 来混淆代码。

现在导出启用了 proguard 的签名 apk 会出现以下错误。

重复的邮政编码条目 [android_6861407322325970495.jar:com/android/vending/billing/IInAppBillingService$Stub$Proxy.class]

任何想法/建议将不胜感激。 谢谢

更新: 以下是完整的跟踪。

java.io.IOException: Can't write [C:\Users\<Name>\AppData\Local\Temp\android_2083818169284424504.jar] (Can't read [C:\Users\<Name>\AppData\Local\Temp\android_6558830429113811056.jar] (Duplicate zip entry [android_6558830429113811056.jar:com/android/vending/billing/IInAppBillingService$Stub$Proxy.class]))
at proguard.OutputWriter.writeOutput(OutputWriter.java:264)
at proguard.OutputWriter.execute(OutputWriter.java:160)
at proguard.ProGuard.writeOutput(ProGuard.java:372)
at proguard.ProGuard.execute(ProGuard.java:153)
at proguard.ProGuard.main(ProGuard.java:492)
Caused by: java.io.IOException: Can't read [C:\Users\<Name>\AppData\Local\Temp\android_6558830429113811056.jar] (Duplicate zip entry [android_6558830429113811056.jar:com/android/vending/billing/IInAppBillingService$Stub$Proxy.class])
at proguard.InputReader.readInput(InputReader.java:230)
at proguard.InputReader.readInput(InputReader.java:200)
at proguard.OutputWriter.writeOutput(OutputWriter.java:253)
... 4 more
Caused by: java.io.IOException: Duplicate zip entry [android_6558830429113811056.jar:com/android/vending/billing/IInAppBillingService$Stub$Proxy.class]
at proguard.io.JarWriter.getOutputStream(JarWriter.java:139)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:105)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:92)
at proguard.io.ClassRewriter.read(ClassRewriter.java:68)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.JarReader.read(JarReader.java:65)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
at proguard.InputReader.readInput(InputReader.java:226)
... 6 more

最佳答案

也许这对你有帮助,

根据 ProGuard 文档:

Warning: can't write resource ... Duplicate zip entry Your input jars contain multiple resource files with the same name. ProGuard continues copying the resource files as usual, skipping any files with previously used names. Once more, the warning may be an indication of some problem though, so it's advisable to remove the duplicates. A convenient way to do so is by specifying filters on the input jars. There is no option to switch off these warnings.

您的库 jar android_6558830429113811056.jar 中有重复的资源条目“IInAppBillingService$Stub$Proxy.class”

您可以尝试使用-outjars

-outjars class_path Specifies the names of the output jars (or wars, ears, zips, or directories). The processed input of the preceding -injars options will be written to the named jars. This allows you to collect the contents of groups of input jars into corresponding groups of output jars. In addition, the output entries can be filtered, as explained in the filters section. Each processed class file or resource file is then written to the first output entry with a matching filter, within the group of output jars.

You must avoid letting the output files overwrite any input files. For better readability, class path entries can be specified using multiple -outjars options. Without any -outjars options, no jars will be written.

或者如果您使用-injars,您可以配置 filter

关于android - Proguard 与应用内购买 "Duplicate zip entry"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20326791/

相关文章:

android - 将 Proguard 应用于 Google Play 上的现有应用

android - 在应用程序中解压缩 .zip 文件 |加速器 |钛

ios - Apple Pay iOS Swift 申请优惠券

android - 在 InApp 购买中出现此错误代码 3 的可能性有哪些?

android - 实现 Google Play 结算的智能方法

java - 如何不混淆带有列表参数的方法

android - 一次设置多个按钮的 setonlongclicklistener

Android - 旋转菜单的一部分超出屏幕

android - 使用 getDrawingCache 保存 View 位图会产生黑色图像

java - 如何在我的 spring mvc 应用程序中运行 proguard,没有 jar 但用于类?