Local AAR file dependencies

If you create a library that you want to reuse in different Android applications, you can build a .aar file, and add it to your project as a dependency. The .aar file will be generated in the build/output/aar/ folder of the module's directory when building the library.

Put the aar file in the libs directory (create it if needed) e.g. PROJECT-ROOT/app/libs

repositories {  
   flatDir {   
     dirs 'libs' 

This will make it possible to add any file inside that folder as a dependency. You can reference the dependency as follows:

assume file name is libraryname.aar

dependencies {  
  compile(name:'libraryname', ext:'aar')