Android gradle equivalent to runtimeClasspath

The gradle java plugin has a FileCollection property that contains runtime classes - sourcesets.main.runtimeClasspath .

Is there an equivalent in the com.android.application plugin?

+5
source share
1 answer

I found that the destinationDir property of applicationVariants can be added to the javaCompile.classpath property, which will result in a FileCollection that contains the dependency class classes and compiled classes.

My use case is trying to execute a java executable postcompile:

 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 with the launch of 'com.android.tools.build:gradle:2.1.0' and gradle 2.10.

Link: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Shrinking-Resources

+1
source

All Articles