我正在尝试在我的Android应用上运行Proguard并遇到问题。
我正在使用SpongyCastle jar(复制和过去的完整充气城堡,包重命名,所以它不与版本中建造的机器人充气城堡冲突)
运行proguard时,我看到以下内容
我该如何解决这个问题?将rt.jar添加到我的库中?
proguard的重点是缩小代码,但我不断添加jar来解决这些问题,其中proguard抱怨它无法找到一个类!我错过了什么吗?
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.InitialDirContext
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.InitialDirContext
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchControls
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchControls
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchControls
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchControls
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchControls
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.DirContext
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.NamingEnumeration
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.NamingEnumeration
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchResult
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchResult
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.Attributes
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.Attribute
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.Attribute
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.NamingEnumeration
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.DirContext
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.NamingException
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.DirContext
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.NamingEnumeration
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.Attributes
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.DirContext
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.DirContext
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchResult
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.NamingEnumeration
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchControls
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.NamingEnumeration
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.NamingException
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.DirContext
[proguard] Note: the configuration refers to the unknown class 'android.app.backup.BackupAgentHelper'
[proguard] Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
[proguard] Note: there were 2 references to unknown classes.
[proguard] You should check your configuration for typos.
[proguard] Warning: there were 57 unresolved references to classes or interfaces.
[proguard] You may need to specify additional library jars (using '-libraryjars'),
[proguard] or perhaps the '-dontskipnonpubliclibraryclasses' option.
UILD FAILED
:\AndroidSDK\android-sdk_r12-windows\android-sdk-windows\tools\ant\build.xml:713: Please correct the above warnings first.
更新
ANT Script
我使用android update project --path .
生成build.xml,因为项目是在前一段时间创建的,我没有做任何更改
<?xml version="1.0" encoding="UTF-8"?>
<project name="RootActivity" default="help">
<loadproperties srcFile="local.properties" />
<property file="ant.properties" />
<loadproperties srcFile="project.properties" />
<fail message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'" unless="sdk.dir" />
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>
答案 0 :(得分:19)
将以下-dontwarn javax.naming.**
添加到您的Proguard配置中。
它们只是警告,忽略它们应该不是问题。
答案 1 :(得分:4)
我认为不需要将rt.jar添加到您的libs中。您需要确保在proguard脚本中正确引用它。看看here的例子。第2节中的这一行是赚钱者:
-libraryjars ${java.home}/lib/rt.jar
但是,如果对proguard使用xml表示法,则语法会发生变化。如果您发布负责的蚂蚁脚本部分,我可以尝试提供更多帮助。希望这有帮助!