Proguard的和Android :(Proguard、Android

2023-09-06 01:57:34 作者:没有心的人〃

我想在我的Andr​​oid应用程序运行Proguard的运行成问题。

我使用SpongyCastle罐

(复制和过去完全充气城堡与包重命名,因此它不与机器人充气城堡建于版本冲突)

在运行ProGuard的我看到下面的

我该如何解决这个问题?添加的rt.jar到我的库?

ProGuard的整点是缩小code,但我一直将罐子来解决这些问题,其中ProGuard的抱怨找不到类!我失去了一些东西?

  [ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.InitialDirContext
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.InitialDirContext
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.SearchControls
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.SearchControls
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.SearchControls
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.SearchControls
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.SearchControls
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.DirContext中
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.NamingEnumeration
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.NamingEnumeration
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.SearchResult的
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.SearchResult的
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.Attributes中
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.Attribute中
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.Attribute中
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.NamingEnumeration
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.DirContext中
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:无法找到引用javax.naming.NamingException中
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.DirContext中
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.NamingEnumeration
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.Attributes中
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.DirContext中
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.DirContext中
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.SearchResult的
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.NamingEnumeration
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.SearchControls
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.NamingEnumeration
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:无法找到引用javax.naming.NamingException中
[ProGuard的]警告:org.spongycastle.x509.util.LDAPStoreHelper:找不到引用的类javax.naming.directory.DirContext中
[ProGuard的]注:配置指的是未知类的android.app.backup.BackupAgentHelper
[ProGuard的]注:配置指的是未知类的com.android.vending.licensing.ILicensingService
[ProGuard的]注:有2引用未知的类。
[ProGuard的]你应该检查你的配置错别字。
[ProGuard的]警告:有57未​​解析引用的类或接口。
[ProGuard的]你可能需要指定其他的jar包(用-libraryjars),
[ProGuard的]或也许是'-dontskipnonpubliclibraryclasses'选项。

UILD失败
:\ AndroidSDK \ Android的sdk_r12-WINDOWS \ Android的SDK-WINDOWS \工具\蚂蚁\ build.xml文件:713:请首先纠正上述警告。
 

更新

  Ant脚本
 
仅用5分钟,搞定Android同事所有不规范代码

我用 Android的更新项目--path。生成的项目是在一段时间以前,我还没有作出任何改变的build.xml

 < XML版本=1.0编码=UTF-8&GT?;
    <项目名称=RootActivity默认为帮助>
        < loadproperties SRCFILE =local.properties/>
        <属性文件=ant.properties/>
        < loadproperties SRCFILE =project.properties/>
        <失败消息=sdk.dir缺少确保生成使用Android的更新项目的local.properties。除非=sdk.dir/>
        <导入文件=$ {sdk.dir} /tool​​s/ant/build.xml/>
    < /项目>
 

解决方案

我不认为有必要添加的rt.jar到您的库。你需要确保你在你的ProGuard脚本正确引用它。看看这里一个例子。这条线在第2的是赚钱机器:

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

尽管如此,如果你使用XML表示法的ProGuard该语法的变化。如果您发布的ant脚本的一部分,这是负责任的,我可以尝试将更多的援助。希望这有助于!

I am trying to run Proguard on my Android app and running into issues.

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)

When running proguard I see the following

How do I fix this? Add rt.jar to my libs?

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! 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 . to generate the build.xml as the project was created sometime ago and I haven't made any changes

<?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>

解决方案

I don't think there is a need to add rt.jar to your libs. You need to make sure you are referencing it properly in your proguard script. Take a look here for an example. This line in section 2 is the money maker:

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

Although, that syntax changes if you use the xml notation for proguard. If you post the part of the ant script that is responsible I can try to be of more assistance. Hope this helps!