导出.apk时Joda时间和ProGuard错误

时间:2014-07-10 09:20:11

标签: java android proguard jodatime

在Eclipse中导出我的.apk并启用proguard时,我收到以下构建错误:

[2014-07-10 04:13:30 - VirginMobile] Proguard returned with error code 1. See console
[2014-07-10 04:13:30 - VirginMobile] Warning: org.joda.convert.JDKStringConverter$9: can't find referenced class javax.xml.bind.DatatypeConverter
[2014-07-10 04:13:30 - VirginMobile] Warning: org.joda.convert.JDKStringConverter$9: can't find referenced class javax.xml.bind.DatatypeConverter
[2014-07-10 04:13:30 - VirginMobile] Warning: org.joda.convert.JDKStringConverter$9: can't find referenced class javax.xml.bind.DatatypeConverter
[2014-07-10 04:13:30 - VirginMobile]       You should check if you need to specify additional program jars.
[2014-07-10 04:13:30 - VirginMobile] Warning: there were 3 unresolved references to classes or interfaces.
[2014-07-10 04:13:30 - VirginMobile]          You may need to specify additional library jars (using '-libraryjars').
[2014-07-10 04:13:30 - VirginMobile] java.io.IOException: Please correct the above warnings first.
[2014-07-10 04:13:30 - VirginMobile]    at proguard.Initializer.execute(Initializer.java:321)
[2014-07-10 04:13:30 - VirginMobile]    at proguard.ProGuard.initialize(ProGuard.java:211)
[2014-07-10 04:13:30 - VirginMobile]    at proguard.ProGuard.execute(ProGuard.java:86)
[2014-07-10 04:13:30 - VirginMobile]    at proguard.ProGuard.main(ProGuard.java:492)

无法在任何其他线程中找到解决方案。

我包括joda-time-2.3.jar和joda-convert-1.6.jar(除了三个错误之外的所有内容)。任何人都知道如何解决这个问题?

非常感谢。

1 个答案:

答案 0 :(得分:10)

Joda类org.joda.convert.JDKStringConverter使用Java API类javax.xml.bind.DatatypeConverter,这在Android API中不可用。

如果你实际上没有使用JDKStringConverter类,Joda可能仍然可以在Android上工作,但ProGuard会尝试确保所有依赖项都得到满足。

您可以尝试通过选项" -dontwarn javax.xml.bind.DatatypeConverter"来告诉ProGuard忽略缺少的依赖项。