ProGuard manual

    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:

    bin/proguard.sh -injars path/to/my-application.jar \
                    -outjars path/to/obfuscated-application.jar \
                    -libraryjars path/to/java/home/lib/rt.jar
    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.

    Android Gradle project

    When working on your Android application (apk, aab) or library (aar), you can include ProGuard in your Gradle build by:

    • Using ProGuard's Gradle plugin, which you can apply in your build.gradle file (AGP 4.x - 7.x).
    • Using the integrated ProGuard by disabling R8 in your gradle.properties (only applicable for AGP < 7).

    For more detailed information see Android Gradle.

    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.

    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: