I'm trying to obfuscate my android application however I'm getting the following error:
[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)
When I add
-dontwarn proguard.ant.**
to proguard.cfg, apk is exported but after installation on phone, it crashes, so it's not the solution in this case...
What should I do to resolve these warnings? It's my first interaction with proguard...
Thanks
My general approach when working with Proguard is to start with a very small .pro
file with everything turned on and then start turning off various obfuscation/optimization/shrinkage options until the resulting jar runs correctly.
So I would suggest running through the Proguard examples page and trying the various -keep
and dontXXX
options which they suggest.
Also, does your application (or the Android framework) make use of native methods, serialization, reflection, callback methods, annotations, etc...? The examples documentation provides settings that you need to pass to Proguard to make sure Proguard's bytecode manipulation does not break these features.
For example, I'm not very familiar with the Android platform, but I believe it uses some type of XML framework which tells it how to load/use the Java classes you define. If that's the case, and you have Proguard obfuscate the class or package names, the XML framework won't be able to find those classes anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With