Android - 当使用Joda Time时,无法使用Proguard导出apk

时间:2014-01-07 11:49:47

标签: android proguard jodatime

我在我的应用程序中使用 joda-time.jar ,当导出签名的apk proguard说出类似的内容时(我看到这是非常常见的问题,当我查看互联网时):

[2014-01-07 12:44:53 - XYZ] Proguard returned with error code 1. See console
[2014-01-07 12:44:53 - XYZ] Warning: org.joda.time.DateMidnight: can't find referenced class org.joda.convert.FromString
[2014-01-07 12:44:53 - XYZ] Warning: org.joda.time.DateTime: can't find referenced class org.joda.convert.FromString
[2014-01-07 12:44:53 - XYZ] Warning: org.joda.time.Days: can't find referenced class org.joda.convert.FromString
...
[2014-01-07 12:44:53 - XYZ] Warning: org.joda.time.Years: can't find referenced class org.joda.convert.FromString
[2014-01-07 12:44:53 - XYZ] Warning: org.joda.time.Years: can't find referenced class org.joda.convert.ToString
[2014-01-07 12:44:53 - XYZ] Warning: org.joda.time.base.AbstractDuration: can't find referenced class org.joda.convert.ToString
[2014-01-07 12:44:53 - XYZ] Warning: org.joda.time.base.AbstractInstant: can't find referenced class org.joda.convert.ToString
[2014-01-07 12:44:53 - XYZ] Warning: org.joda.time.base.AbstractPeriod: can't find referenced class org.joda.convert.ToString
[2014-01-07 12:44:53 - XYZ]       You should check if you need to specify additional program jars.
[2014-01-07 12:44:53 - XYZ] Warning: there were 37 unresolved references to classes or interfaces.
[2014-01-07 12:44:53 - XYZ]          You may need to specify additional library jars (using '-libraryjars').
[2014-01-07 12:44:53 - XYZ] java.io.IOException: Please correct the above warnings first.
[2014-01-07 12:44:53 - XYZ]     at proguard.Initializer.execute(Initializer.java:321)
[2014-01-07 12:44:53 - XYZ]     at proguard.ProGuard.initialize(ProGuard.java:211)
[2014-01-07 12:44:53 - XYZ]     at proguard.ProGuard.execute(ProGuard.java:86)
[2014-01-07 12:44:53 - XYZ]     at proguard.ProGuard.main(ProGuard.java:492)

论坛中的所有地方或此处(Android - Proguard didn't compile with Joda Time jar file)他们都说解决方案应该是 joda-convert.jar ,并添加到buildpath。但对我而言,它只是不起作用,在我做完之后,proguard再次说了类似的东西:

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

如何解决此问题?我花了几个小时尝试一切,但我无法找到它......非常感谢!

1 个答案:

答案 0 :(得分:6)

好的我明白了。实际上添加 joda-convert.jar 来构建路径是有效的,但只适用于旧版本(1.4及更低版本,如果你下载最新版本 - 1.5 joda-convert.jar ,它不起作用)......