Android Integration

Configure Gradle builds and variant-specific policies for ObfGuard.

Gradle setup

ObfGuard integrates into Gradle tasks after compilation. Use variant-specific configuration to align protection with each build type.

  • Install ObfGuard CLI on CI agents
  • Run ObfGuard after assembleRelease
  • Store protection reports as build artifacts

Variant policies

  • Apply stricter policies to release variants
  • Keep debug builds unprotected for developer velocity
  • Define per-module overrides for sensitive SDKs

Command example

./gradlew assembleRelease
obfguard build --policy policies/android.yaml --input app/build/outputs/apk/release/app-release.apk

Compatibility notes

If you use reflection-heavy frameworks, consider scoped exclusions. Use the protection report to see exactly what was transformed.

Always validate Play Store signing and upload flows after protection.

Best practices

  • Separate release and debug policies
  • Exclude dynamic loading modules until validated
  • Review coverage reports every release
  • Keep Gradle and ObfGuard versions pinned

Need help with Android rollout?

Share your Gradle build matrix and we will help tune policy scopes.