0

我在安卓应用程序中使用“jackrabbit-webdav-2.2.5-jar-with-dependencies.jar”。我自己构建了它,只要我直接从 Eclipse 调试或运行应用程序,一切正常。此外,当我将应用程序导出为没有 Proguard 的“签名应用程序包”以便将其安装在任何设备上时,一切正常。

但是当使用 Proguard (java obfuscator) 启动时会出现问题。这是来自控制台的快照:

[2013-09-22 22:23:45 - Zarathustra] Proguard returned with error code 1. See console
[2013-09-22 22:23:45 - Zarathustra] Note: there were 1 duplicate class definitions.
[2013-09-22 22:23:45 - Zarathustra] Warning: org.apache.jackrabbit.commons.AbstractItem: can't find superclass or interface javax.jcr.Item
[2013-09-22 22:23:45 - Zarathustra] Warning: org.apache.jackrabbit.commons.AbstractNode: can't find superclass or interface javax.jcr.Node
[2013-09-22 22:23:45 - Zarathustra] Warning: org.apache.jackrabbit.commons.AbstractProperty: can't find superclass or interface javax.jcr.Item
[2013-09-22 22:23:45 - Zarathustra] Warning: org.apache.jackrabbit.commons.AbstractProperty: can't find superclass or interface javax.jcr.Property
.....
.....
[2013-09-22 22:23:45 - Zarathustra] Warning: org.slf4j.MarkerFactory: can't find referenced class org.slf4j.impl.StaticMarkerBinder
[2013-09-22 22:23:45 - Zarathustra] Warning: org.slf4j.MarkerFactory: can't find referenced class org.slf4j.impl.StaticMarkerBinder
[2013-09-22 22:23:45 - Zarathustra] Warning: there were 2333 unresolved references to classes or interfaces.
[2013-09-22 22:23:45 - Zarathustra]          You may need to specify additional library jars (using '-libraryjars').
[2013-09-22 22:23:45 - Zarathustra] Warning: there were 40 unresolved references to program class members.
[2013-09-22 22:23:45 - Zarathustra]          Your input classes appear to be inconsistent.
[2013-09-22 22:23:45 - Zarathustra]          You may need to recompile them and try again.
[2013-09-22 22:23:45 - Zarathustra]          Alternatively, you may have to specify the option 
[2013-09-22 22:23:45 - Zarathustra]          '-dontskipnonpubliclibraryclassmembers'.
[2013-09-22 22:23:45 - Zarathustra] java.io.IOException: Please correct the above warnings first.
[2013-09-22 22:23:45 - Zarathustra]     at proguard.Initializer.execute(Initializer.java:321)
[2013-09-22 22:23:45 - Zarathustra]     at proguard.ProGuard.initialize(ProGuard.java:212)
[2013-09-22 22:23:45 - Zarathustra]     at proguard.ProGuard.execute(ProGuard.java:87)
[2013-09-22 22:23:45 - Zarathustra]     at proguard.ProGuard.main(ProGuard.java:493)

我尝试了几个 proguard 标签,但没有帮助。似乎 proguard 需要在类路径中显式地使用所有依赖项。也许这个问题必须用maven解决?(我不是使用 maven 的专家——我尝试了几件事,但没有帮助)。

有人也有这样的问题吗?任何建议或提示如何解决它?

提前致谢!约翰

4

1 回答 1

3

ProGuard 确实需要所有依赖项来进行静态分析。但是,丢失的类可能从未使用过,因此您可以告诉 ProGuard 忽略它们:

-dontwarn javax.jcr.**
-dontwarn org.slf4j.**

请参阅 ProGuard 手册 > 故障排除 >警告:找不到引用的类

于 2013-09-25T00:33:48.353 回答