How to use aar files in android project in Android Studio?

1.3k views Asked by At

I have spent a lot of hours in this. I have created two library projects lets say A and B. Project B has dependency over A, so I used A as aar in library project B.

Now I have created an android application which has dependency over library project B. I have added aar file for project B in my application. So far I am able to access files created in B project from my android application but I am unable to access files of A project.

I guess B comprises of files defined by itself and A project( let me know if I am wrong). Now I have to use A and B project's aar in my application which I don't think is good because B is already using A. Can anybody suggest how to build a library project which depends on other project's aar file so as to access files from both the projects?

I am sorry If I am unable to explain what it is?

2

There are 2 answers

2
Logic On

Follow the steps:

  • Extract the aar
  • In the extracted folder you have classes.jar
  • Place the jar file in the libs folder of your Project B & add to build path
  • Mark your Project B as library (in the properties -> Android scroll to bottom and check the checkbox)
  • Add your Project B as library to main project
0
Sohail Zahid On

Follow these steps Very easy to add arr file in android studio.

Step A:

enter image description here

Step B:

enter image description here

Step C:

enter image description here

Step D:

enter image description here

Step E:

enter image description here

Step F:

enter image description here

Step G:

enter image description here

You are Done.