Java Android上的Proguard和JMDNS问题

Java Android上的Proguard和JMDNS问题,java,android,proguard,jmdns,Java,Android,Proguard,Jmdns,这就是故事:我需要为Android库配置Proguard,它包含一个带有JMDNS库的.jar文件。我知道代码工作得很好 当我启用proward并尝试构建库时,控制台上会显示以下错误 Warning:javax.jmdns.impl.DNSCache: can't find referenced method 'java.util.concurrent.ConcurrentHashMap$KeySetView keySet()' in program class javax.jmdns.impl

这就是故事:我需要为Android库配置Proguard,它包含一个带有JMDNS库的.jar文件。我知道代码工作得很好

当我启用proward并尝试构建库时,控制台上会显示以下错误

Warning:javax.jmdns.impl.DNSCache: can't find referenced method 'java.util.concurrent.ConcurrentHashMap$KeySetView keySet()' in program class javax.jmdns.impl.DNSCache
Warning:javax.jmdns.impl.DNSCache: can't find referenced class java.util.concurrent.ConcurrentHashMap$KeySetView
Warning:there were 2 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:there were 1 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
读了一会儿,我发现标签
-dontwarn
可以用来忽略这类警告。应用后,控制台显示此警告

Warning:javax.jmdns.impl.DNSCache: can't find referenced method 'java.util.concurrent.ConcurrentHashMap$KeySetView keySet()' in program class javax.jmdns.impl.DNSCache
Warning:there were 1 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
有没有办法消除该消息,以便编译过程可以继续?我尝试使用失败的方法添加另一个
-dontwarn
,甚至添加标记
-ignorewarnings
,但没有成功

顺便说一下,我的proguard-rules.pro:

-keep class com.google.common.io.Resources {
    public static <methods>;
}
-keep class com.google.common.collect.Lists {
    public static ** reverse(**);
}
-keep class com.google.common.base.Charsets {
    public static <fields>;
}

-keep class com.google.common.base.Joiner {
    public static Joiner on(String);
    public ** join(...);
}

-keep class com.google.common.collect.MapMakerInternalMap$ReferenceEntry
-keep class com.google.common.cache.LocalCache$ReferenceEntry
-keep class java.util.concurrent.ConcurrentHashMap$KeySetView

-dontwarn sun.misc.Unsafe
-dontwarn java.util.concurrent.ConcurrentHashMap$KeySetView
-保留com.google.common.io.Resources类{
公共静态;
}
-保留com.google.common.collect.list类{
公共静态**反向(**);
}
-保留com.google.common.base.charset类{
公共静态;
}
-保留com.google.common.base.Joiner类{
公共静态接合器(串);
公众**加入(…);
}
-保留com.google.common.collect.MapMakerInternalMap$ReferenceEntry类
-保留类com.google.common.cache.LocalCache$ReferenceEntry
-保持类java.util.concurrent.ConcurrentHashMap$KeySetView
-dontwarn sun.misc
-dontwarn java.util.concurrent.ConcurrentHashMap$KeySetView

提前感谢

我自己解决了这个问题,并且会回答我自己的问题,这样这个解决方案可以帮助其他人

警告基本上指出了解决方案:

Your input classes appear to be inconsistent.
You may need to recompile the code.
起初我认为这是我需要重新编译的代码,但相反,是JMDNS代码出错了。在下载源代码并自己编译之后,问题没有出现