PreEmptive Protection - DashO Gradle v2.3 User Guide

Troubleshooting

Page Contents

Verifying the plugin is available

Run gradlew tasks

If you applied the com.preemptive.dasho or com.preemptive.dashoJar plugin, you should see tasks like obfuscate or obfuscateJar listed in the build section.

If you applied the com.android.application or com.android.library plugin the tasks differ based on the version of the plugin you are using. If you are using the 1.7 (or earlier) plugin, you should see tasks like obfuscate[Flavor]Release or obfuscate[Flavor]LibraryRelease listed in the build section. If you are using the 1.8 (or later) plugin, you should see a dashOPluginVersion task listed in the other section.

If you do not encounter an error and do not see one of those tasks listed, make sure you have applied the plugin in your script.

If you encounter an error, first double-check the versions being used. See Version Compatibility.

Here are some common errors and solutions:

Error: Unexpected char '\' ... flatDir dirs: {The Path to the DashO Installation}

Make sure you use forward slashes ('/') when specifying the path.

Error: Could not find method dashOConfig() for arguments...

Make sure you apply one of the plugins: com.preemptive.dasho, com.preemptive.dashoJar, com.android.application, com.android.library, or com.preemptive.dashoCustom. If you applied com.android.application or com.android.library double check the order of the dependencies. Also make sure that dashOConfig is not inside any other closure.

Error: Plugin with id 'com.preemptive.dasho*' not found.

Make sure you have referenced the plugin in the dependencies closure.

Error: Could not find any version that matches com.preemptive:dasho:X.Y+.

Make sure you have referenced the directory containing the dasho-x.y.z jar file in the repositories closure.

Error: Could not set unknown property 'maxHeap' for object of type com.preemptive.dasho.gradle.DashOExtension

Make sure you are using version 1.7.0 (or later) of the DashO Gradle Plugin.

Error: Could not set unknown property 'transformName' for object of type com.preemptive.dasho.gradle.DashOExtension

Make sure you are using version 2.2.1 (or later) of the DashO Gradle Plugin.

Error: Could not set unknown property 'skipManifestProcessing' for object of type com.preemptive.dasho.gradle.DashOExtension

Make sure you are using version 2.3.1 (or later) of the DashO Gradle Plugin.

Error: Could not create plugin of type 'AppPlugin' (or 'LibraryPlugin').

Make sure you are using compatible versions of the Android and DashO plugins. See Version Compatibility.

Error: Failed to notify project evaluation listener.

Make sure you are using compatible versions of the Android and DashO plugins. See Version Compatibility.

Error: unable to resolve class com.android.build.OutputFile (or some other com.android... class)

Make sure you are using compatible versions of the Android and DashO plugins. See Version Compatibility.

Error: A problem occurred evaluating [root] project ...

Make sure you are using compatible versions of the Android and DashO plugins. See Version Compatibility.

Verifying the configuration is correct

Run gradlew build

If you applied and configured the plugin correctly, DashO will obfuscate your code.

If you encounter an error, here are some common errors and solutions:

Error: File '{project path}/project.dox' specified for property 'doxFile' does not exist.

Solution 1: Make sure you have specified the doxFilename in the dashOConfig closure. It defaults to look for project.dox or a name based on the flavor of an Android build.

Solution 2: You are using DashO's com.android.application or com.android.library plugin and have other Android projects which are compiled in the same Gradle build which are not yet configured to use DashO. Add dashOConfig {disabledForBuildTypes=['debug', 'release']} inside build.gradle of the other projects until you have configured them to use DashO.

Error: DashOHome is not configured.

Make sure you either specify the dashOHome in the dashOConfig closure or in the DASHO_HOME environment variable.

Error: tried to access method org.gradle.api.tasks.JavaExec.exec()V...

You are using an old version of Gradle, please upgrade to a later version.

Error: Cannot find "some.aar" in: ...

Make sure you spelled the filename correctly in includeAsInputs or dexExcluded. If any of the paths listed contain build-cache you may need to disable caching.

Errors during obfuscation

If an error occurs during obfuscation the information should be listed in the output. Double check that you used ${gradleInput} and ${gradleOutput} in your DashO configuration.

Error: java.lang.OutOfMemory: Java heap space or java.lang.OutOfMemory: GC overhead limit exceeded

Increase (or set) the maxHeap (see the configuration section). If you are using a version earlier than 1.7 try the following:

  1. Add a new task to the gradle build script. Make sure you define it with the proper obfuscation task name(s) you see when running gradlew tasks.

     task setMaxMem << {
         project.tasks['obfuscateDebug'].maxHeapSize=536870912 //bytes
         project.tasks['obfuscateRelease'].maxHeapSize=536870912 //bytes
     }
    
  2. Call it manually before your build task (E.G. gradlew setMaxMem build)

Error: Option --properties not understood.

Make sure you are using version 8.1.0 (or later) of DashO.

Gradle issues after obfuscation

Some errors can occur from misconfiguration of the project .dox file.

Error: {BUILD_DIR}\manifests\debug\..\dasho-debug\AndroidManifest.xml: error: Unable to open file for read: No such file or directory.

Solution 1: Make sure you have specified ${AndroidManifestFile} and ${AndroidManifestOutput} in the Non-Class Files section of the .dox file.

Solution 2: Make sure you are using DashO version 7.5 (or later).

Issue: I am using the com.preemptive.dasho plugin and there are no classes in the jar file created by Gradle.

Make sure you have used ${gradleOutput} as the output location the .dox file (and that it is a merged directory).

Issue: I am using the com.preemptive.dashoJar plugin and do not see the obfuscated_libs directory in my build folder.

Make sure you have used ${gradleOutput} as the output location the .dox file (and that it is a jar file).

Temporarily Disabling DashO Integration

If you would like to run a build without the tasks added by DashO, you can disable them by adding -DDISABLE_DASHO to the command line when you run gradlew.

Note: The DISABLE_DASHO setting will have no impact if you are using the com.preemptive.dashoCustom plugin as it does not add any tasks.

Troubleshooting Parameters

If you would like to see all the parameters passed to DashO, add -DSHOW_DASHO_CMD to the command line when you run gradlew. This will print out the contents of the .properties file passed to DashO and show the full command line used to run DashO.

Note: This is only supported in versions 1.7 and later.

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