我在Android应用中使用“jackrabbit-webdav-2.2.5-jar-with-dependencies.jar”。 我自己构建了它,只要我直接从eclipse调试或运行应用程序,一切正常。 此外,当我将应用程序导出为没有Proguard的“已签名的应用程序包”以便在任何设备上安装时,everthing工作正常。
但是当使用Proguard(java混淆器)时会启动问题。以下是控制台的快照:
[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的专家 - 我尝试了几件事,但他们没有帮助。)
有人也有这样的问题吗? 有任何建议或提示如何解决?
提前致谢! 约翰
答案 0 :(得分:3)
ProGuard确实需要其静态分析的所有依赖项。但是,可能从未使用过丢失的类,因此您可以告诉ProGuard忽略它们:
-dontwarn javax.jcr.**
-dontwarn org.slf4j.**
请参阅ProGuard手册>疑难解答> Warning: can't find referenced class