Arjun Babu C
Arjun Babu C

Reputation: 1

Is there any way to access methods of one aar file from another aar file in project libs folder?

I generated two aar files from two libraries generated by me and added them to my main project by putting them in the libs folder. Now I can able to access classes of the aar from the main project. But I want to call the class of the first aar from second. Is it possible?

Upvotes: 0

Views: 559

Answers (1)

avalerio
avalerio

Reputation: 2335

The second aar would need the first aar as a dependency. You can get away with the first aar being compileOnly with the second aar, because the main project can provide the actual library.

I noticed one of the tags you have is modularization. This kind of relationship between the 2 libraries is not modularization but tightly coupled they might as well be the same library.

What you need to do is rethink your 2 libraries and how they are supposed to interact with the outside world.

If library 1 produces an output pass it to library 2, instead of library 2 retrieving it, itself.

Your main app is the glue.

Upvotes: 0

Related Questions