简体   繁体   中英

Proguard Obfuscation for JAR files

I know how to obfuscate executable jar files due to the fact that it has a main class. But I'm trying to create my API (It's already done) and I just need to obfuscate the code. The problem is that whenever I try obfuscate the jar file using Proguard (A well known java obfuscator) it gives me an error about something to do with the 'keep'. I am running the proguard-gui from Proguard and in Eclipse, I exported the project as a normal jar file (not executable) and I'm trying to obfuscate that jar file. Also, I am not including the .classpath and .project files inside my jar file either. If anyone could please help/guide me in obfuscating non-executable jar files in Proguard, it would be very useful and appreciated. Thank you.

Note: I'm using Proguard's GUI to obfuscate, not anything to do with the command line.

Image of problem: 在此处输入图片说明

In your config file for Proguard, you need to specify which classes you want to keep, otherwise Proguard will just reduce away everything. The most common kind of keep line looks something like:

-keep my.applications.package.*

or

-keep my.applications.package.MainClass

You can find examples of configuration files on the Proguard webpage

Cfr ProGuard manual > Examples > A typical library

The GUI has a checkbox for processing libraries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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