Resource Protection
Protection ID: resourceProtection
Resource Protection secures your application's resources against extraction and analysis tools. It prevents attackers from easily accessing embedded assets, configuration files, and other resources bundled in the APK.
Configuration
shield {
protections {
resourceProtection = true
}
}shield {
protections {
resourceProtection = true
}
}How It Works
Android APKs contain a res/ directory and an assets/ directory that are trivially extractable with tools like apktool. Resource protection applies transformations to the application's resource tables and embedded assets during the build process, making automated extraction tools produce incomplete or corrupted output.
This protects layout files (XML layouts that reveal the application's UI structure), string resources (localized strings that may contain business logic hints), asset files (embedded databases, configuration files, ML models), and drawable resources (images and icons).
Combining with Other Protections
Resource Protection complements code-level protections by ensuring that both the code and the data it operates on are protected:
protections {
stringEncryption = true // Protect strings in code
resourceProtection = true // Protect strings in resources
antiTamper = true // Detect resource modifications
}protections {
stringEncryption = true // Protect strings in code
resourceProtection = true // Protect strings in resources
antiTamper = true // Detect resource modifications
}When to Use
Resource protection is recommended for applications that embed sensitive configuration files, include proprietary assets such as ML models or databases, contain layout structures that reveal business logic, or bundle any data that should not be easily extractable from the APK.
Related
- String Encryption - Protect string literals in bytecode
- Anti-Tamper - Detect resource modifications
- Protections Overview - All available protections