3

I get this stacktrace during "dexguard" task (all lines did begin with timestamp and [ERROR] [org.gradle.BuildExceptionReporter]):

Caused by: groovy.lang.MissingMethodException: No signature of method: com.android.build.gradle.internal.core.GradleVariantConfiguration.getAllLibraries() is applicable for argument types: () values: []
at com.guardsquare.dexguard.h.getProguardFiles(DexGuard7.1.23:1090)
at com.guardsquare.dexguard.ao.doCall(DexGuard7.1.23:784)
at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:590)

I'm using DexGuard v7.1.23, Android Studio 2.2, default gradle 2.14.1, on Windows 7 64b.

The error happens after I change (in all relevant build.gradle scripts):

     dependencies {
-        classpath 'com.android.tools.build:gradle:2.1.3'
+        classpath 'com.android.tools.build:gradle:2.2.0'

With gradle plugin 2.1.3 the build works.

I tried to debug it in Android Studio, by remotely connecting to gradle, but while the "pause" button in debugger looks like it pauses the process, and I can resume the execution, it will not show any code (probably needs sources of gradle and all involved plugins?).

I think the error is most likely in the dexguard gradle plugin code, which access something what is not available in android gradle plugin 2.2.0 anymore.


Question time:

How to even debug/fix something like this? I'm used to some non-trivial build schemes from huge C++ projects involving make files and various scripts executing external tools (where I can easily check every build error at source level and get exact idea what binary was called with what parameters and why), but this gradle ecosystem with so many dynamic parts downloaded from some network repositories and extremely slow Groovy execution control is a bit too complex for me, way over my head.

Is there (not very difficult) way to debug the build process (I'm not talking about native debugger and debugging the VM itself, while possible, that sounds useless in the result)? Maybe some simple way to get also source packages from repositories, similar to linux's -src.pkg, just by adding dependency?

Or can I find the cached dexGuard gradle plugin binary somewhere, disassemble it, check what it calls, and rewrite it by hand in my own script?

Any advices how to get more info about that gradle blackbox appreciated, ie. how it works, why it failed, etc... (although I'm not considering to learn also whole Groovy properly, especially as I don't get that mindset even for the core language (I'm simple guy, thinking in ASM and C++), and if I understand it well, the gradle extends it in quite domain specific way, so pure Groovy is not even enough to understand those scripts fluently?).

Ped7g
  • 16,236
  • 3
  • 26
  • 63
  • I'm actually interested where I can find the build code of dexguard gradle plugin on my machine, so I can take a peek. I'm sort of sure it's trivial enough to move it inside my build.gradle directly + fix the problem, but I'm lost in the gradle, never sure what gets actually executed and how. By the duration of the build process I would guess it's simulating some CERN project on background... – Ped7g Sep 22 '16 at 09:38
  • I get the same error, however, I didn't run dexguard task but just clean and generateDebugSources task. So it should be the android.build:gradle:2.2.0 plugin is not compatible enough, now I use 2.1.0. It's good! – kidoher Oct 12 '16 at 03:48

1 Answers1

3

You have two options:

  • stay with Android gradle plugin 2.1.0 or earlier
  • update DexGuard to a more recent version (latest is 7.2.12) which supports 2.2.0+

Edit:

In order to better understand why these things happen: the DexGuard plugin uses the API from the Android gradle plugin. If the API changes in a new version the DexGuard plugin has to adapt to the newer API while still keeping backwards compatibility to older versions.

T. Neidhart
  • 6,060
  • 2
  • 15
  • 38
  • I have to move back to 2.1.x of gradle plugin. DexGuard 7.2.12 is the same. – Tuan Chau Sep 21 '16 at 08:42
  • Can you send the versions that you were using to support@guardsquare.com ? Afaik, only beta versions of 2.2.0 have been tested so far to be working, but maybe something else has changed in the mean time. – T. Neidhart Sep 21 '16 at 09:25
  • Would also be keen to know when they expect to support gradle build tools 2.2+. Creates a dependency on Dexguard for us to upgrade our projects for upgrading. – fakataha Oct 12 '16 at 04:00
  • The latest DexGuard versions 7.2.XX already support the gradle build tools 2.2+. If you are having problems with upgrading then it is most likely due to the gradle daemon that caches the old dexguard.jar. – T. Neidhart Oct 12 '16 at 15:57