Search code examples
androidgradledependenciesandroid-gradle-pluginandroid-library

Built android library module doesn't have its dependencies inside


I built an Android library module which has some dependencies (.aar files inside its libs directory). If I import the built .aar file into another project, its dependencies not resolved.

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

defaultConfig {
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    //compile project(':ExoPlayer')
    compile(name: 'ExoPlayer', ext: 'aar')
    compile(name: 'Volley', ext: 'aar')
    compile 'com.danikula:videocache:2.3.4'
}

Solution

  • The aar file doesn't contain the nested (or transitive) dependencies and doesn't have a pom file which describes the dependencies used by the library.

    It means that, if you are importing a aar file using a flatDir repo you have to specify the dependencies also in your project.