gradle Add .aar file to Android project using gradle


Example

  1. Navigate to project's app module and create libs directory.
  2. Place your .aar file there. For example myLib.aar.
  3. Add the code below to android block of app level's build.gradle file.
  repositories {
        flatDir {
            dirs 'libs'
        }
    }

This way you defined a new extra repository that points to app module's libs folder.

  1. Add the code below to dependencies block or the build.gradle file:
compile(name:'myLib', ext:'aar')