/

Protections Overview

Shield provides 9 protections that work individually or together to create layered security for your Android application.


Protection Categories

Code Obfuscation

These protections make your code harder to understand when decompiled:

ProtectionDSL PropertyEffect
Name ObfuscationnameObfuscationRenames classes, methods, and fields to short meaningless identifiers
Control Flow ObfuscationcontrolFlowObfuscationRestructures method logic with opaque predicates and dead code paths
Reference ProxyreferenceProxyReplaces direct method calls with proxy indirection layers

Data Protection

These protections hide sensitive data embedded in bytecode:

ProtectionDSL PropertyEffect
String EncryptionstringEncryptionEncrypts string literals, decrypted at runtime
Constant MutationconstantMutationReplaces numeric constants with arithmetic expressions
Resource ProtectionresourceProtectionProtects application resources from extraction and analysis

Runtime Protections

These protections detect and respond to attacks at runtime:

ProtectionDSL PropertyEffect
Anti-DebugantiDebugDetects debuggers, Frida, Xposed, and instrumentation tools
Anti-TamperantiTamperVerifies application integrity, detects package modifications
Debug RemovaldebugRemovalStrips debug metadata from bytecode

Baseline (Low Risk)

For applications that need basic protection without complexity:

Groovy
protections {
    stringEncryption = true
    debugRemoval = true
    constantMutation = true
}

Standard (Most Applications)

A balanced configuration for production applications:

Groovy
protections {
    stringEncryption = true
    constantMutation = true
    debugRemoval = true
    controlFlowObfuscation = true
    antiDebug = true
    referenceProxy = true
}

Maximum (High Security)

For financial, healthcare, or other security-critical applications:

Groovy
protections {
    stringEncryption = true
    constantMutation = true
    debugRemoval = true
    nameObfuscation = true
    controlFlowObfuscation = true
    antiDebug = true
    referenceProxy = true
    resourceProtection = true
    antiTamper = true
}

If R8 is enabled (minifyEnabled true), set nameObfuscation = false and let R8 handle renaming.


Protection Compatibility

All 9 protections can be enabled simultaneously. They are applied in a specific order to avoid conflicts:

  1. Debug Removal (strips metadata)
  2. String Encryption (encrypts literals)
  3. Constant Mutation (transforms constants)
  4. Name Obfuscation (renames identifiers)
  5. Control Flow Obfuscation (restructures logic)
  6. Reference Proxy (adds indirection)
  7. Resource Protection (protects resources)
  8. Anti-Debug (injects runtime checks)
  9. Anti-Tamper (injects integrity verification)

Excluding Elements from Protection

Use annotations to exclude individual classes, methods, or fields from protection:

Java
@Keep                    // Exclude from ALL protections
@DoNotObfuscate          // Exclude from name obfuscation only
@Exclude(protections = {"StringEncryption"})  // Exclude from specific protections

Use excluded packages to skip entire package trees.


Previous
Excluded Packages