【问题标题】:Joda time and ProGuard error when exporting .apk导出 .apk 时出现 Joda 时间和 ProGuard 错误
【发布时间】:2014-07-10 09:20:11
【问题描述】:

在 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(除了三个错误之外,其他所有错误)。有谁知道如何解决这个问题?

非常感谢。

【问题讨论】:

    标签: java android proguard jodatime


    【解决方案1】:

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

    如果您实际上不使用 JDKStringConverter 类,Joda 可能仍然可以在 Android 上运行,但 ProGuard 会尝试确保满足所有依赖项。

    您可以尝试使用“-dontwarn javax.xml.bind.DatatypeConverter”选项告诉 ProGuard 忽略缺少的依赖项。

    【讨论】:

    • 这是我找到的最接近答案的东西。虽然它对我来说并不完全有效(编译后仍然有两个错误),但简单地忽略其余错误似乎就可以了。我最终完全放弃了 Joda,但这不是重点。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    • 1970-01-01
    • 1970-01-01
    • 2019-07-14
    • 1970-01-01
    • 2019-02-14
    相关资源
    最近更新 更多