Eclipse Plugin

DexGuard can be integrated in the Eclipse build process of the Android Developer Tools (version 23.0.1.1256982 or higher).

Setting up the Eclipse plugin

You can enable DexGuard in the Android Eclipse build as follows:
  1. Optionally copy the configuration file from DexGuard's ant directory to the main directory of your Android project:
    dexguard-project.txt
    
  2. Copy the plugin from DexGuard's eclipse directory to the dropins directory of your Eclipse install:
    com.saikoa.dexguard.eclipse.adt_*.jar
    
When starting or restarting Eclipse, the Android build process will automatically use DexGuard for all Android builds. You can verify that the plugin is installed by checking that the menu item discussed below is present. If Eclipse didn't pick up the plugin, you should try starting it with the -clean option.

If you experience any compatibility problems, you should check and possibly update the version of the plugin of the Android Developer Tools:

Help > About Eclipse SDK > Installation Details > Installed Software

Building

The procedure for building Android applications remains essentially the same. Ordinary builds use debug settings, without optimization or obfuscation. A new Export option allows you to build with the release settings, with full optimization and obfuscation:
File > Export... > Export Optimized and Obfuscated Android Application (DexGuard)

Menu bar

File menu Export panel

The DexGuard Eclipse plugin picks up custom configurations from the following optional files in your Android project:

dexguard-project.txt         (for all builds)
dexguard-project-debug.txt   (for debug builds)
dexguard-project-release.txt (for release builds)
proguard-project.txt         (for backward compatibility with ProGuard)
The default version of the first file contains a number of settings that can be enabled to perform string encryption, class encryption, and to hide access to sensitive APIs.

The logs for debug builds and export builds are sent to the Android console panel.

Settings

You can selectively override settings from the configuration files in the preferences panel:
Window > Preferences > Android > Obfuscation (DexGuard)

Menu bar

Window menu Preferences panel

By default, debug builds don't shrink, optimize, or obfuscate the application. You can enable shrinking if your application is otherwise too large for the size constraints of the Dalvik format. Make sure that you have suitable configuration files for your project, so DexGuard doesn't inadvertedly remove code that is only accessed through reflection. If you only enable shrinking, you can still debug the processed application interactively. If you enable optimization or obfuscation, it's generally no longer possible to debug the processed application interactively, since the bytecode no longer corresponds closely to the source code.

On the other hand, export builds generally do shrink, optimize, and obfuscate the application. You can interactively disable any of these steps if ever needed.

Settings for regular builds

You can specify the same general preferences as before. Notably, you can specify the verbosity of the build process (including DexGuard) in the preferences panel:
Window > Preferences > Android > Build

You can also disable the DexGuard builder for regular builds, in the properties panel of each project:

Project > Properties > Builders > Android Optimizer and Obfuscator (DexGuard)

Menu bar

Project menu

Properties panel

After having disabled the builder, you currently need to restart the project to properly reinitialize the builders.

Quick troubleshooting

If you are having problems running the Eclipse plugin:

Please consult the more extensive troubleshooting section if you encounter other issues building or running your application.

Uninstalling the Eclipse plugin

You can uninstall the plugin by removing the file com.saikoa.dexguard.eclipse.adt_*.jar again from the dropins directory of your Eclipse install.
Copyright © 2002-2014 Saikoa BVBA.