There can be different types of dependencies in a project:
dependencies { // Dependency on the "mylibrary" module from this project compile project(":mylibrary") // Remote binary dependency compile 'com.android.support:appcompat-v7:24.1.0' // Local binary dependency compile fileTree(dir: 'libs', include: ['*.jar']) }
You can also use aar files defining flatDir :
repositories { flatDir { dirs 'libs' } }
then adding a dependency:
dependencies { compile(name:'nameOfYourAARFileWithoutExtension', ext:'aar') }
To create a library module , simply create a module in Android Studio and use in module/build.gradle
apply plugin: 'com.android.library'
Then you can use it like:
- project (
compile project(":mylibrary") ) - you can create aar file and use it as aar file
- Download the library to the maven repository and use it as a remote dependency
source share