0

i have created an android library AAR in android studio 2.1.3 in which i use the following dependencies:

compile 'com.google.android.gms:play-services-vision:9.4.0+'
compile 'com.google.android.gms:play-services-wearable:9.4.0+'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'

now i am using this aar in an application but those dependencies were failing unless i add them to the dependencies of the new app.

i search here and i found that i need to add the following line:

compile (project(':LIBNAME-release')) {transitive = true}

but this didn't work. is there something i missed? or is it related to the obfuscation i did to the aar file? or is it a must to add these dependencies to the app?

Rolf ツ
  • 8,464
  • 5
  • 46
  • 72
lallous34
  • 473
  • 1
  • 4
  • 11

2 Answers2

2

Please follow below steps to get it working ( I have tested it up to Android Studio 2.2)

Lets say you have kept aar file in libs folder. ( assume file name is cards.aar )

then in app build.gradle specify following and click sync project with Gradle files.

allprojects {
   repositories {
      jcenter()
      flatDir {
        dirs 'libs'
      }
   }
}

dependencies {
    compile(name:'cards', ext:'aar')
}

If everything goes well you will see library entry is made in build -> exploded-aar

Also note that if you are importing a .aar file from another project that has dependencies you'll need to include these in your build.gradle, too.

go through this link

siddhesh
  • 1,365
  • 1
  • 10
  • 16
0

Try to compile you project first:

dependencies {
    compile project(':Name-Of-Your-Project')
}

This is Ashton Engberg's suggestion from that post

Community
  • 1
  • 1
Sergey Bubenshchikov
  • 5,097
  • 2
  • 31
  • 54
  • this is what i am using now. but the project asks for the dependencies i used inside the aar. shall i use the dependencies also in the app other than the aar – lallous34 Dec 30 '16 at 10:36