/

Shield for Android

ByteHide Shield for Android protects your Java and Kotlin applications against reverse engineering, code analysis, and tampering. It integrates directly into your Gradle build pipeline, applying compile-time obfuscation and runtime protections to produce hardened APKs and AABs.

Shield for Android protects your Java and Kotlin applications against reverse engineering, code analysis, and tampering. It integrates directly into your Gradle build pipeline and applies protections at compile time, producing a hardened APK or AAB with no runtime dependencies beyond a lightweight decryption library.


How It Works

Shield operates as a Gradle plugin that transforms your compiled bytecode during the build process. When you run a release build, Shield intercepts the compiled .class files before packaging and applies the configured protections.

The process is transparent to your development workflow: you configure which protections to enable, and Shield handles the rest automatically on every build.


What It Protects Against

Shield addresses the core vulnerabilities of Android applications:

  • Reverse engineering: Decompilers like JADX and JD-GUI produce readable source from unprotected APKs. Shield makes decompiled output incomprehensible through name obfuscation, control flow transformation, and reference proxying.
  • String extraction: Attackers search for API keys, URLs, and credentials in plaintext strings embedded in the bytecode. String encryption renders these unreadable at rest.
  • Static analysis: Automated tools analyze code structure to find vulnerabilities. Control flow obfuscation and constant mutation break the patterns these tools rely on.
  • Dynamic analysis: Debuggers and instrumentation frameworks like Frida attach to running applications. Anti-debug detection identifies and responds to these tools at runtime.
  • Tampering: Attackers modify APKs to bypass license checks, remove ads, or inject malicious code. Anti-tamper verification detects modifications to the application package.

Available Protections

Shield provides 9 protections organized in three categories:

Code Obfuscation

ProtectionDSL PropertyWhat It Does
Name ObfuscationnameObfuscationRenames classes, methods, and fields to meaningless identifiers
Control Flow ObfuscationcontrolFlowObfuscationInserts opaque predicates and restructures method logic
Reference ProxyreferenceProxyReplaces direct method calls with proxy indirection layers

Data Protection

ProtectionDSL PropertyWhat It Does
String EncryptionstringEncryptionEncrypts string literals and decrypts them at runtime
Constant MutationconstantMutationTransforms numeric constants into equivalent expressions
Resource ProtectionresourceProtectionProtects application resources from extraction and analysis

Runtime Protections

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

Quick Example

Add Shield to an existing Android project in three steps:

1. Add the plugin

Groovy
// app/build.gradle
plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.bytehide.shield' version '1.0.0'
}

2. Configure protections

Groovy
shield {
    projectToken = "your-project-token"

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

    excludedPackages = ['android', 'androidx', 'kotlin', 'kotlinx']
}

3. Build

Bash
./gradlew assembleRelease

Shield processes the bytecode automatically during the build. The output APK contains protected code.


ProGuard & R8 Compatibility

Shield is fully backward-compatible with ProGuard. Your existing proguard-rules.pro rules, ProGuard annotations (@androidx.annotation.Keep, @ProguardKeep), and mapping file workflows work with Shield out of the box — no migration or rewriting required. Shield also works alongside R8 for code shrinking. See R8 & ProGuard Compatibility for full details.


Requirements

RequirementMinimum
Android Gradle Plugin7.0+ (Transform API) or 8.0+ (Artifacts API)
Java11+
Kotlin1.8+ (if using Kotlin)
minSdk21
InternetRequired during build for license validation

Next Steps

Quick Start

Step-by-step guide to protect your first Android application

Gradle Setup

Complete installation and repository configuration

Protections

Detailed guide to all 9 available protections

Annotations

Fine-grained control with @Keep, @DoNotObfuscate, and @Exclude