Get extracted aar dependencies in code


I need to reach the contents of android aar dependencies in my custom plugin.

I found that artifacts are cached in .gradle/caches/modules-2/files-2.1/[package]/[id]/[version]/[sort-of-hash]/artifact.aar, and these are extracted to .gradle/caches/transforms-1/files-1.1/[id-version]/[sort-of-hash]/ so the latter contains jars/classes.jar and res/.

I’m able to get paths to aars from resolved configurations and extract them manually, but it seems not quite right since they are already extracted.