I'm struggling with this issue for quite some time now but haven't find any proper solution online so I thought I would ask here for help.
I'm using Android Studio to build an Android Library module. my library contains 3 build type ('release', 'debug' & 'releaseDebug') & 2 flavors (1 flavor dimension): 'generic' & 'custom'. I want to be able to generate a jar from this library at the end of each build variant run. The issue is that all the examples regarding the 'Jar' task refer to copying the generated 'classes.jar' file from 'build/bundles/' wheres in my case, the 'classes.jar' file is generated in a different path each time depending on the buildVariant: for 'assembleGenericRelease' the 'classes.jar' is generated in 'build/intermediates/bundles/generic/debug/', for 'assembleCustomDebug' under 'build/intermediates/bundles/custom/debug' etc.
My question is: How can I get the location of the generated 'classes.jar' file during the build process so I can copy & process it in a custom task?
Currently I'm using a custom task to get the input 'taskRequests' (from 'gradle.getStartParameters.getTaskRequests.get(0).getArgs()') so I can parse & get the path for classes.jar file but its pretty ugly and I still believe there must be a better way to do so.
In the end what I'm trying to achieve is Building 6 variants of this Android Library, where each build generates an '.aar' file & '.jar' file where in the 'release' buildType variants - the final '.aar' & '.jar' where also processed by DexGuard for obfuscation.
Any help on this topic would be appreciated.