Dex Protector

DexProtector is the protector and obfuscator for Android platform. It helps secure Android applications and Android libraries (AARs) against unauthorized or illegal use, reverse engineering, and cracking.

The technology keeps all known DEX decompilers and copy protection removal tools at bay. It also makes static and dynamic, manual and automatic code analysis and tampering much more difficult.

Add Dex Protector to Android Project

First of all download the latest dex protector enterprise version:

../_images/dexprotector_version.png

After that add root gradle file dexprotector-ent reference and on dependencies, dexprotector plugin classpath:

../_images/root_gradle.png

Locate app gradle file, apply plugin dexprotector and set dex configuration inside build types:

../_images/app_gradle.png

Finally add dex protector configuration file on project directory path as shown below:

../_images/dexprotector_config.png

Encrypt Apk

Method 1 (Recommended)

In order to build a protected APK file in Android Studio, launch Build > Generate Signed Apk

Method 2

Locate Gradle projects, navigate on :app/Tasks/build/assemble (debug or release) and run it

../_images/gradle_projects.png

Check Apk Encryption

Method 1 (fast and only android studio needed)

In Android Studio launch Build > Analyze APK… > Search and open the apk encrypted file

At the end of the analysis, locate the classes.dex and classes2.dex files and check if there are references to classes inside the library.

In the classes.dex file only the it.monksoftware.{PROJECTNAME}. ProtectedAppApplication class should be visible.

In the classes2.dex file, classes related to realm/tables will probably be visible

Method 2 (More accurate)

Download The Unarchiver program:

../_images/the_unarchiver.png

After that locate generated apk and decompile it using The Unarchiver program; you should see classes dex files:

../_images/classes_dex.png

Than move classes dex files to dex2jar-2.0 folder previously downloaded:

../_images/classes_dex_dex2jar.png

Finally run from terminal this command ./d2j-dex2jar.sh classes2.dex, decompile jar using The Unarchiver and than check if apk is correctly encrypted:

../_images/dex2jar.png ../_images/unenc_jar.png