简体   繁体   English

Proguard和Android :(

[英]Proguard and Android :(

I am trying to run Proguard on my Android app and running into issues. 我试图在我的Android应用程序上运行Proguard并遇到问题。

I am using SpongyCastle jar (copy and past of full bouncy castle with package renamed so it does not conflict with androids bouncy castle built in version) 我正在使用SpongyCastle jar(复制和过去的完整充气城堡与包重命名,所以它不与版本中建立的机器人充气城堡冲突)

When running proguard I see the following 运行proguard时,我看到以下内容

How do I fix this? 我该如何解决? Add rt.jar to my libs? 将rt.jar添加到我的库中?

The whole point of proguard is to shrink the code, but I keep adding jars to get around these issues where proguard complains it cannot find a class! proguard的重点是缩小代码,但我不断添加jar来解决这些问题,其中proguard抱怨它无法找到一个类! Am I missing something? 我错过了什么吗?

[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.

Update 更新

ANT Script

I used android update project --path . 我使用了android update project --path . to generate the build.xml as the project was created sometime ago and I haven't made any changes 在项目创建之前生成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>

Add the following, -dontwarn javax.naming.** , to your Proguard configuration. 将以下-dontwarn javax.naming.**添加到您的Proguard配置中。

They are just warnings, and ignoring them shouldn't be an issue. 它们只是警告,忽略它们应该不是问题。

I don't think there is a need to add rt.jar to your libs. 我认为不需要将rt.jar添加到libs中。 You need to make sure you are referencing it properly in your proguard script. 您需要确保在proguard脚本中正确引用它。 Take a look here for an example. 看看这里的例子。 This line in section 2 is the money maker: 第2节中的这一行是赚钱的人:

-libraryjars ${java.home}/lib/rt.jar

Although, that syntax changes if you use the xml notation for proguard. 但是,如果对proguard使用xml表示法,则语法会发生变化。 If you post the part of the ant script that is responsible I can try to be of more assistance. 如果您发布负责的蚂蚁脚本部分,我可以尝试提供更多帮助。 Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM