Files
proguard/docs/md/manual/quickstart.md
tvoc-gs 764d35e4d5 Update manual (#321)
* Update manual

* Delete  and

---------

Co-authored-by: James Hamilton <james.hamilton@guardsquare.com>
2023-03-02 13:20:42 +00:00

2.8 KiB

Quick Start

This page will guide you through the basic steps of processing your application or library with ProGuard. For details on advanced settings or more background information please refer to the relevant parts of the manual.

There are two ways to execute ProGuard:

  1. Standalone
  2. Integrated mode in your Gradle, Ant or Maven project.

You can also build ProGuard from source by following the build instructions.

Standalone

Firstly, download a ProGuard release or build ProGuard from source. ProGuard can then be executed directly from the command line by calling a script found in the bin directory:

=== "Linux/macOS" bash bin/proguard.sh -injars path/to/my-application.jar \ -outjars path/to/obfuscated-application.jar \ -libraryjars path/to/java/home/lib/rt.jar

=== "Windows" bat bin\proguard.bat -injars path/to/my-application.jar ^ -outjars path/to/obfuscated-application.jar ^ -libraryjars path/to/java/home/lib/rt.jar

For more detailed information see standalone mode.

Integrated

The ProGuard artifacts are hosted at Maven Central.

Java or Kotlin Gradle project

Your non-mobile Java or Kotlin applications can execute ProGuard's Gradle task:

task myProguardTask(type: proguard.gradle.ProGuardTask) {
.....
}

For more detailed information see Java/Kotlin Gradle.

Android Gradle project

The default Android shrinker R8 is fully compatible with ProGuard keep rules. You can refer to the configuration guide for help with keep rules or use the ProGuard Playground to visualise keep rules.

For setup and integration, please follow the instructions to enable R8.

Ant project

You can also include ProGuard in your Ant build, all you have to do is to include the related task into your build.xml file:

<taskdef resource="proguard/ant/task.properties"
        classpath="/usr/local/java/proguard/lib/proguard.jar" />

For more detailed information see Ant.

Maven project

!!! warning While we don't officially provide a maven integration and we cannot provide support there are solutions available, their offered functionality is not guaranteed by Guardsquare.

Some open-source implementations: