2013-03-07 65 views
4

我有一個android應用程序,它在項目的/ libs /目錄中有dnsjava.jar。一切都很好,可以打包成APK(沒有proguard)。使用DNSJava庫混淆Android代碼的Proguard

然而,當我介紹的ProGuard到project.properties(在eclipse),我得到以下警告:

[2013-03-07 14:16:08 - ] Proguard returned with error code 1. See console 
[2013-03-07 14:16:08 - ] Warning: org.xbill.DNS.spi.DNSJavaNameServiceDescriptor: can't find superclass or interface sun.net.spi.nameservice.NameServiceDescriptor 
[2013-03-07 14:16:08 - ] Warning: org.xbill.DNS.spi.DNSJavaNameServiceDescriptor: can't find referenced class sun.net.spi.nameservice.NameService 
[2013-03-07 14:16:08 - ] Warning: org.xbill.DNS.spi.DNSJavaNameServiceDescriptor: can't find referenced class sun.net.spi.nameservice.NameServiceDescriptor 
[2013-03-07 14:16:08 - ] Warning: org.xbill.DNS.spi.DNSJavaNameServiceDescriptor: can't find referenced class sun.net.spi.nameservice.NameService 
[2013-03-07 14:16:08 - ] Warning: org.xbill.DNS.spi.DNSJavaNameServiceDescriptor: can't find referenced class sun.net.spi.nameservice.NameService 
[2013-03-07 14:16:08 - ]  You should check if you need to specify additional program jars. 
[2013-03-07 14:16:08 - ] Warning: there were 5 unresolved references to classes or interfaces. 
[2013-03-07 14:16:08 - ]   You may need to specify additional library jars (using '-libraryjars'). 
[2013-03-07 14:16:08 - ] java.io.IOException: Please correct the above warnings first. 
[2013-03-07 14:16:08 - ] at proguard.Initializer.execute(Initializer.java:321) 

使用-keep類org.xbill ** {*; }在proguard-project.txt似乎並沒有解決這個問題。

+0

嗨如何啓用ProGuard的設置,你的應用程序在Eclipse ........ – androidgeek 2013-03-07 06:31:48

+0

嗯,閱讀四周,發現添加-dontwarn org.xbill。**似乎解決這個問題。哎... – Pell 2013-03-07 06:36:03

+0

嘗試在您的proguard.config文件中添加'-dontwarn'標記。 – GrIsHu 2013-03-07 06:38:08

回答

3

這是測試與proguard & DNSJava。希望能幫助到你。從asmack自述複製

# This dnsjava class uses old Sun API 
-dontnote org.xbill.DNS.spi.DNSJavaNameServiceDescriptor 
-dontwarn org.xbill.DNS.spi.DNSJavaNameServiceDescriptor 

# See http://stackoverflow.com/questions/5701126, happens in dnsjava 
-optimizations !code/allocation/variable 
相關問題