Check out this answer, which shows that you can use dexTask.additionalParameters
to pass additional arguments to the dx
tool. An easy way to get access to the dexTask
is from the variants list:
android.applicationVariants.all { variant ->
Dex dexTask = variant.dex
if (dexTask.additionalParameters == null) dex.additionalParameters = []
// This is just an example:
dexTask.additionalParameters += '--help'
// you could use others, such as '--multi-dex', or anything else that appears in the '--help' output.
}
From the source of AndroidBuilder.java
, you can see which commandline arguments are already being added to the dx
tool before appending your additionalParameters
.