1
Add plugin dependency to your app build.gradle:
    buildscript {
        repositories {
            maven { url = "https://branchlock.net/android/" }
            ...
        }
        dependencies {
            classpath group: 'net.branchlock',
                name: 'obfuscation',
                version: '1.1.2'
                ...
        }
    }
                                
2
Apply and configure the plugin in your app build.gradle:
    /* do not place this inside the plugins block */
    apply plugin: net.branchlock.obfuscation.ObfuscationPlugin
    branchlock {
       configFile = 'branchlock.json' // the path to your branchlock config json file
       apiKey = 'YOUR_API_KEY' // your API key
       uploadLibs = true // needs to be enabled if class not found errors appear
       obfuscateDebug = false  // also obfuscate non-release testing versions. can be used to test if obfuscation is working
       excludeLib 'com.google.android.gms', 'com.google.ads' // exclude classes that start with your string from being uploaded as library to save time
       fullLibCode = false // shrinks libraries by default before uploading to save time. Needs to be enabled if you do not want to shrink your libraries.
    }
                                
Done!
Executions Toggle all
1
2
3
Reference encryption mode

Uses reflection to encrypt references. Equally secure as dynamic mode, takes less file size and supports java versions older than 8.

String encryption mode

Faster than enhanced mode and compatible with java 5 and above, but less secure.

Stacktrace encryption key

This key is used to encrypt stacktrace source files and line numbers. You need this key to decrypt stacktraces of your end-users after obfuscation. If your key is lost, no decryption is possible anymore.

Member name generation mode

Which alphabet to use for class names, method names and field names. If your jar file already has obfuscated class and member names, adaptive mode is recommended to make branchlock match your class and member names.

Exclude classes
Include excluded classes