The gradle java plugin has a FileCollection property which contains the runtime classes - sourcesets.main.runtimeClasspath.
Is there an equivalent within the com.android.application plugin?
The gradle java plugin has a FileCollection property which contains the runtime classes - sourcesets.main.runtimeClasspath.
Is there an equivalent within the com.android.application plugin?
What I've found is that the destinationDir property of applicationVariants can be appended to the javaCompile.classpath property, which will result in a FileCollection which contains the dependency classpaths and the compiled classes.
My use case is trying to run a java executable post-compile:
afterEvaluate {
android.applicationVariants.each { variant ->
variant.javaCompile.doLast {
javaexec {
classpath += variant.javaCompile.classpath
classpath += files(variant.javaCompile.destinationDir)
main = 'com.mydomain.Main'
}
}
}
}
Tested on Android Studio 2.1.1 running 'com.android.tools.build:gradle:2.1.0' and gradle 2.10.
Reference: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Shrinking-Resources