PreEmptive Protection - DashO Gradle v2.3 User Guide

Android Configuration

Overview

If using DashO's com.android.application or com.android.library plugin, your output in DashO must be configured to be a jar. In addition to configuring ${gradleInput} and ${gradleOutput}, a non-class file must be configured for the AndroidManifest.xml. Use ${AndroidManifestFile} as the source file and ${AndroidManifestOutput} as the relative destination. You will also need to add the correct android.jar file to the supporting classpath section of your .dox file and use your package name as the renaming prefix. If you are obfuscating a library, you should also configure DashO to remove the compiled {package name}.R* classes and make sure the classes which will be referenced by applications are configured as entry points.

DashO has a project wizard that will configure most of these settings for you, if you use it for initial DashO project setup.

Note: If you have a setup with multiple Gradle projects built at the same time, you will need to disable DashO on the other projects. You can quickly do this by adding dashOConfig {disabledForBuildTypes=['debug', 'release']} inside build.gradle of the other projects until you have configured them to use DashO.

The following User Properties can also be used if needed:

  • ${buildType} - The type of build being run (E.G. debug or release).
  • ${sdk.dir} - The directory where the Android SDK is located.
  • ${build.dir} - The directory containing Gradle build output.
  • ${sdk.target} - The target sdk api.
  • ${manifest.package} - The package name for the application.
  • ${gradleSupport} - The list of support jars.
  • ${KEYSTORE} - The location of the key store.
  • ${KEYSTORE_PASSWORD} - The password to access the key store.
  • ${KEY_ALIAS} - The key alias.
  • ${KEY_ALIAS_PASSWORD} - The password to access the key.

Note: The signing information is only passed when it is configured in the Android build.

Build Flavors

If you are working with different build flavors in your Android configuration and need different DashO configurations for the different flavors, you will need to create multiple DashO configuration files, name them based on the flavor, and remove any doxFilename setting from the dashOConfig closure. For Example: If you have two flavors: personal and pro, you would create a personal.dox and pro.dox configuration. When the DashO task runs, and does not find any configured doxFilename, it will search for a file based on the flavor/build type (E.G. proDebug.dox, pro.dox, or debug.dox) If it can't find one, then it will assume project.dox.

Note: If you use flavor dimensions, the final name for each combined flavor should be used to name the .dox file.

Advanced functionality

APK Splitting

The DashO Gradle plugin supports the APK Splitting functionality provided by the base Android Gradle plugin.

Multidex

The DashO Gradle plugin supports, on Lollipop (and later) devices, the multidex functionality provided by the base Android Gradle plugin. For older devices you will need to make the following changes to your .dox file.

  1. Add the multidex library to your inputs. It will probably be located in build/intermediates/exploded-aar/com.android.support/multidex/1.0.1/jars/classes.jar.
  2. Add the android.support.multidex.MultiDexApplication class with its <init>() method as an Entry Point.

Resource Shrinking

The DashO Gradle plugin supports the resource shrinking functionality provided by the base Android Gradle plugin. It is recommended DashO be configured to remove all non-used classes and methods as resource shrinking relies on checking the compiled code for references to the resources.

Instant Run

Instant Run is not supported by DashO. If Instant Run is enabled, the DashO Transform will automatically be turned off. This should not affect your release builds. If you want to disable Instant Run, view the instructions at http://developer.android.com/studio/run/index.html#disable-ir

Built-in Shrinker

If you want to use the Android's experimental non-obfuscating built-in shrinker, follow the instructions at https://developer.android.com/studio/build/shrink-code.html#gradle-shrinker. Then add that build type to the disabledForBuildTypes in the dashOConfig configuration.

Jack and Jill

DashO is not currently compatible with the experimental Jack and Jill build tools. You will need to use the standard build tools.

PreEmptive Protection - DashO Gradle Version 2.3.2.21+7441f77. Copyright © 2017 PreEmptive Solutions, LLC