0

I created a module and now I am trying to export the .aar file but I cannot include the gradle dependencies I used in the module to the .aar file. I tried the solution of this post with no success. Here is how my app level .build file looks like:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28
    buildToolsVersion "29.0.2"

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles 'consumer-rules.pro'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation ('com.daimajia.androidanimations:library:2.3@aar')
    {transitive=true}
    implementation ('com.google.android.exoplayer:exoplayer-core:2.10.0')
    {transitive=true}
    implementation ('tyrantgit:explosionfield:1.0.1')
    {transitive=true}
}

What am I missing?

stavros.3p
  • 2,244
  • 6
  • 20
  • 37
  • AFAIK dependencies inside the .aar files can not be used in the project importing the .aar file. You need to re-add those dependencies on your main project. I don't recall the exact word, but it was something like **transitive** dependencies not supported for .aar files – sebasira Apr 14 '20 at 11:08
  • @sebasira That's weird given that the post I referenced in my question says that you can add dependencies to .aar files using transitive. Maybe something changed in the new versions of Android Studio? – stavros.3p Apr 14 '20 at 11:23
  • I remember having the same issue. The so called fat-aar, an aar with all it's dependencies being transitive and I could not make it work. Maybe it was related to the gradle version used. I don't remember. – sebasira Apr 14 '20 at 11:46
  • see this: https://stackoverflow.com/a/36931247/2597775 – sebasira Apr 14 '20 at 11:48
  • @sebasira "It means that, if you are importing a aar file using a flatDir repo you have to specify the dependencies also in your project." That doesn't make sense, because I unzip the .aar file and the dependencies are not there. Also I can't use a maven repository. – stavros.3p Apr 14 '20 at 12:21

0 Answers0