0

These are the dependencies of a library module called "mylibrary1" inside project 1

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  api 'com.android.volley:volley:1.0.0'
  ...
}

The keyword api is here to transitively expose this dependency to the consumers of my own library (I'm using Gradle 3). Everything goes fine and the .aar file is made.

Then let's move to another project 2 which is the consumer of the library. I click on file > new module > import .jar/.aar and select the aar file that I made before.

I checked if settings.gradle includes the new module, then a dependency is added to the consumer in this way

api project(':mylibrary1')

Again, the keyword api is necessary to reuse the code from another project that will use the aar of project 2. Anyway, it doesn't change at all even if I put the keyword implementation.

From the classes of project 2 I can see all of my classes in mylibrary1, except those in Volley.

What am I doing wrong? How should I do to solve this problem?

user3290180
  • 4,260
  • 9
  • 42
  • 77

1 Answers1

1

When you package your AAR, it won't include the transitive dependencies, only your own code. So you'll need to add a Volley dependency in your project 2.

John Leehey
  • 22,052
  • 8
  • 61
  • 88