Reputation: 7966
I'm using Antenna to build, pack and obfuscate a j2me app. Building and packing works fine.
The project uses a 3rd party jar that is already obfuscated except by some interfaces.
When trying to obfuscate I got several errors like:
[wtkobfuscate] Warning: i: can't find referenced class fooPackage.fooClass
Class i and fooPackage.fooClass is from this 3rd party jar that I mentioned.
UPDATE:
This 3rd party library uses j2me-xmlrpc.jar. If I don't package all together then I won't be able to obfuscate the 3rd party interfaces and the j2me-xmlrpc.jar. (and I can't run the app this way, not sure why)
If I package only the j2me-xmlrpc.jar and my project classes I get the this error while obfuscating
[wtkobfuscate] Warning: there were 2 instances of library classes depending on program classes.
UPDATE 2:
I know this obfuscation is possible beacause in Netbeans I can do obfuscation using Proguard.
Since Netbeans internals uses ANT to make builds I tried to copy the generated build.xml to my own build.xml.
For obfuscation Netbeans uses the library org-netbeans-modules-mobility-antext.jar that can be used outside Netbeans. I imported this library to my project and used it without problem.
But I get the same error I got using antenna.
Obfuscating in Netbeans generates a lot of warnings but it still generates the obfuscated jar.
What I'm missing?
Upvotes: 1
Views: 2348
Reputation: 7966
I was using Proguard 4.3. Downgrading to Proguard 4.2 solved the problem.
Upvotes: 1
Reputation: 15925
try using jshrink. I have much better results with it then with proguard:
<java jar="obfuscator\jshrink.exe" fork="true">
<arg value="..\${projectdir}\${projectname}.jar"/>
<arg value="-classpath"/>
<arg pathref="project.class.path"/>
<arg value="-keep"/>
<arg value="${midletclass}"/>
<arg value="-o"/>
<arg value="..\${projectdir}\${projectname}.jar"/>
</java>
Upvotes: 0
Reputation: 14222
If the 3rd party library is obfuscated, don't include that library while you obfuscate your classes. Rather follow these steps
Upvotes: 1