我正在尝试模糊我的Android应用程序但是我收到以下错误:
[2012-04-15 19:55:51 - TmtAndroid] Proguard returned with error code 1. See console
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.ClassPathElement: can't find referenced method 'org.apache.tools.ant.Project getProject()' in class proguard.ant.ClassPathElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.ClassPathElement: can't find referenced method 'boolean isReference()' in class proguard.ant.ClassPathElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.ClassPathElement: can't find referenced method 'java.lang.Object getCheckedRef(java.lang.Class,java.lang.String)' in class proguard.ant.ClassPathElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.ClassPathElement: can't find referenced method 'java.lang.String[] list()' in class proguard.ant.ClassPathElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.ClassPathElement: can't find referenced method 'void setLocation(java.io.File)' in class proguard.ant.ClassPathElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.ClassSpecificationElement: can't find referenced method 'boolean isReference()' in class proguard.ant.ClassSpecificationElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.ClassSpecificationElement: can't find referenced method 'java.lang.Object getCheckedRef(java.lang.Class,java.lang.String)' in class proguard.ant.ClassSpecificationElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.ConfigurationElement: can't find referenced method 'boolean isReference()' in class proguard.ant.ConfigurationElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.ConfigurationElement: can't find referenced method 'java.lang.Object getCheckedRef(java.lang.Class,java.lang.String)' in class proguard.ant.ConfigurationElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.ConfigurationTask: can't find referenced method 'org.apache.tools.ant.Project getProject()' in class proguard.ant.ConfigurationTask
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.FilterElement: can't find referenced method 'boolean isReference()' in class proguard.ant.FilterElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.FilterElement: can't find referenced method 'java.lang.Object getCheckedRef(java.lang.Class,java.lang.String)' in class proguard.ant.FilterElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.KeepSpecificationElement: can't find referenced method 'boolean isReference()' in class proguard.ant.KeepSpecificationElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.KeepSpecificationElement: can't find referenced method 'java.lang.Object getCheckedRef(java.lang.Class,java.lang.String)' in class proguard.ant.KeepSpecificationElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.MemberSpecificationElement: can't find referenced method 'boolean isReference()' in class proguard.ant.MemberSpecificationElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.MemberSpecificationElement: can't find referenced method 'java.lang.Object getCheckedRef(java.lang.Class,java.lang.String)' in class proguard.ant.MemberSpecificationElement
[2012-04-15 19:55:51 - TmtAndroid] Warning: proguard.ant.ProGuardTask: can't find referenced method 'org.apache.tools.ant.Project getProject()' in class proguard.ant.ProGuardTask
[2012-04-15 19:55:51 - TmtAndroid] You should check if you need to specify additional program jars.
[2012-04-15 19:55:51 - TmtAndroid] Warning: there were 17 unresolved references to program class members.
[2012-04-15 19:55:51 - TmtAndroid] Your input classes appear to be inconsistent.
[2012-04-15 19:55:51 - TmtAndroid] You may need to recompile them and try again.
[2012-04-15 19:55:51 - TmtAndroid] Alternatively, you may have to specify the option
[2012-04-15 19:55:51 - TmtAndroid] '-dontskipnonpubliclibraryclassmembers'.
[2012-04-15 19:55:51 - TmtAndroid] java.io.IOException: Please correct the above warnings first.
[2012-04-15 19:55:51 - TmtAndroid] at proguard.Initializer.execute(Initializer.java:321)
[2012-04-15 19:55:51 - TmtAndroid] at proguard.ProGuard.initialize(ProGuard.java:211)
[2012-04-15 19:55:51 - TmtAndroid] at proguard.ProGuard.execute(ProGuard.java:86)
[2012-04-15 19:55:51 - TmtAndroid] at proguard.ProGuard.main(ProGuard.java:492)
当我添加
-dontwarn proguard.ant.**
到proguard.cfg,apk已导出但在手机上安装后崩溃了,所以在这种情况下它不是解决方案......
我该怎么做才能解决这些警告?这是我与proguard的第一次互动...
由于
答案 0 :(得分:1)
使用Proguard时的一般方法是从一个非常小的.pro
文件开始,打开所有内容,然后开始关闭各种混淆/优化/收缩选项,直到生成的jar正确运行。
因此,我建议您浏览Proguard examples page并尝试他们建议的各种-keep
和dontXXX
选项。
此外,您的应用程序(或Android框架)是否使用本机方法,序列化,反射,回调方法,注释等......?示例文档提供了传递给Proguard所需的设置,以确保Proguard的字节码操作不会破坏这些功能。
例如,我对Android平台不是很熟悉,但我相信它使用某种类型的XML框架来告诉它如何加载/使用你定义的Java类。如果是这种情况,并且您让Proguard模糊了类或包名称,那么XML框架将无法再找到这些类。