I already tried to set up Proguard but I got stuck in a lot of errors regarding missing Kotlin libraries, and have not found a single guide (that is for jvm, not android) teaching how to use Proguard with Kotlin, so as my last resource I came here to ask for help, a guide, anything, thanks. I also would love to know how do I set up custom dictionaries for Proguard (on Gradle).
Regarding the custom dictionary;
On he configuration page you will see the option -obfuscationdictionary explained, which can be used to set up a custom dictionary.
Regarding the Kotlin errors;
Could you please provide the full stack trace? Do you see the error/warning during the build or at runtime? The troubleshooting guide might be able to help you tackle the issue.
Have you already found the ProGuard Playground? Here you can visualise the ProGuard configuration on your class tree without the need of building the project every single time.
The documentation only includes guides to Gradle in Android, there is not a single mention of desktop Java in it (which is surprising), not a single Gradle buildscript usage in anything that is not Android.
The error is the following:
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.tools.build:gradle:3.0.0.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
- https://plugins.gradle.org/m2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
Required by:
project : > com.guardsquare:proguard-gradle:7.0.1
I cannot even set up the task if I cannot Proguard Gradle imported, I would really appreciate a solution to this missing android-tools dependency. I’m not in android, why is Proguard requiring it?
Thanks, that solved the issue, now my proguard runs, but I got another issue: My proguard task runs, and more often than not the proguard.jar is not generated, it reports in Gradle > Task :proguard UP-TO-DATE even when there’s no proguard.jar file. I tried to keep running the task to see if that would solve the issue, tried to delete the built shaded jar file, but no, didn’t work out. Sometimes clearing the cache or changing the Proguard version works, but it’s a guessing game, some times it generate the jar file and other times it don’t do anything and just report “up-to-date”.