Adding /libs/ folder to android aar release

Help! I cant take it anymore!!

I am trying to do what I thought would be the simplest thing ever. I have an android-library project and am trying to include the /libs/ folder but having no luck. I know generally its best to rely on a distributed pom and let the users of the aar utilise gradles normal dependency resolution but I dont want to do that for this case.

Looking at I can see libs is optional. I am using gradle 2.3 and android plugin 1.2.1 and have tried variations on

android {
    sourceSets {
        main {
            resources.includes = [ '**/libs/*.jar' ]        

but no cigar…any tips/ help please!?

EDIT: I should mention the libs folder actually contains .jars and .aars

Not an android user myself but i believe it’d be

dependencies {
   compile fileTree('path/to/libs', {
      includes '*.jar' 
android { ... } 

Thanks for reply. I am already adding the local files in libs as dependencies via compile: name: "... and thats all fine and everything builds correctly / stuff is on the classpath etc. The problem is that the .aar does not by default contain the /lib/ folder - this is generally best practise but in this case I want to include.

aars can contain lib folders as shown here and maybe this is a specific problem using the android-publish plugin as others suggestions of adding to the sourcesets does not work either.

I didnt try include the dependencies with your method as opposed to the one I am currently using but as expected this alone does not add the /libs/ folder into the output aar.


You’re best to ask this on the adt-dev forum

Thanks - this has now been answered here