[JAVA] Things to check when it doesn't work with proguard

A story about exporting a javaFX project and trying to obfuscate the created jar file. From the conclusion, the cause was that the annotation disappeared when obfuscated by proguard. As a countermeasure, I first tried to obfuscate with the following settings that do nothing.

#sample.pro
#Setting to do nothing

-injars  'C:\******\input.jar'
-outjars 'C:\******\output.jar'

#External jar
-libraryjars 'C:\Program Files\Java\jdk1.8.0_144\jre\lib\rt.jar'
-libraryjars 'C:\****\*****.jar'
-libraryjars 'C:\****\*****.jar'

#Attribute setting
-keepattributes *Annotation*, Signature, Exceptions, InnerClass

#Class setting
-keep class * {
    *;
}

If this doesn't work, the jar file settings may be incorrect. If it works, remove the obfuscated part from here. For example, classify each package as shown below and set each individually.

$sample2.pro
#Individual settings for each package

-injars  'C:\******\input.jar'
-outjars 'C:\******\output.jar'

#External jar
-libraryjars 'C:\Program Files\Java\jdk1.8.0_144\jre\lib\rt.jar'
-libraryjars 'C:\****\*****.jar'
-libraryjars 'C:\****\*****.jar'

#Attribute setting
-keepattributes *Annotation*, Signature, Exceptions, InnerClass

#Class setting
-keep class package1.* { *;}
-keep class package2.* { *;}
-keep class package3.* { *;}
-keep class package4.* { *;}

Recommended Posts

Things to check when it doesn't work with proguard
When PyCall doesn't work with PyCall :: PythonNotFound
Check when nvidia-smi on Ubuntu doesn't work
Check if you're using Databinding and it doesn't work
@ClassRules doesn't work with PowerMockRunner
Things to keep in mind when using Sidekiq with Rails
When you deploy to Heroku but it doesn't reflect well
[Beginner] When rails s doesn't work
What to do if validation doesn't work with the update action
Links I want to help when JSF doesn't work at all
Check when moss with SimpleDateFormat parse
Things to forget when intercepting a request with Android's WebView # shouldInterceptRequest
It's okay to combine null with Java's `+` operator (it doesn't drop with nullpo)
Things to keep in mind when using Apache PDFBox® with AWS Lambda
When I try to sign up with devise, it automatically redirects to root_path
Simulator does not work: Unable to boot device due to insufficient system resources
Things to check when it doesn't work with proguard
What to do if TextToSpeech doesn't work on Android 11
SCSS doesn't work when deploying Rails6 AWS
java.lang.ClassNotFoundException: Correspondence when it comes with javax.xml.bind.JAXBException
What to do when is invalid because it does not start with a'-'
When I tried to use a Wacom tablet with ubuntu 20.04, I didn't recognize it.
Things to be aware of when writing Java
(RubyMine) Check when you cannot debug with docker-compose
Things to keep in mind when committing to CRuby
How to delete the tweet associated with the user when you delete it at the same time
When importing CSV with Rails, it was really easy to use the nkf command
When I tried to support IPv6 easily with Docker-proxy, I couldn't do it before I knew it.
What to do when routing settings do not work after building Docker environment with Laravel
7 things I want you to keep so that it doesn't become a fucking code