6

Could you help me to understand the general concept of building android library and use it in user's application.

So, there is following situation:

In android studio there are following modules:
core
data
drawing

and there is a module
app
with dependencies on above modules.

app.gradle

dependencies {
    compile project(':core')
    compile project(':data')
    compile project(':drawing')
}

so I can run the app from Android Studio.

But I would like to have something like AAR file and include it in any app to be able use it again without creation the same modules.

I'm not very familiar with Gradle so I'm not sure is it possible and how to do it.

vetalitet
  • 703
  • 2
  • 10
  • 25
  • I ran into the same issue, did you ever found a solution to this? – Rensodarwin Nov 05 '15 at 21:20
  • When I created this issue I didn't understand how it works, that's why I wanted to bind all my module's AAR into one AAR. But as I realized, it's fairly complicated to achieve. and because of each module (like data, core, etc) is a unique, separate item, which can be used in any other project - there is no need to bind them in one general AAR. So I decided to create private maven repository, and upload all AARs in this repo. And who needs some module, may use it using this private repo. – vetalitet Nov 08 '15 at 06:39
  • Thanks for your response, I will start looking into the maven repository thanks again. – Rensodarwin Nov 09 '15 at 14:48
  • Possible duplicate of [Android Studio how to package single AAR from multiple library projects?](http://stackoverflow.com/questions/20700581/android-studio-how-to-package-single-aar-from-multiple-library-projects) – JosephH Jan 25 '17 at 14:05

1 Answers1

1

From my experience, an AAR is created for each library module.

Generated AAR created during build can be found in "yourmodule\build\outputs\aar". (on Android Studio) You can use these AAR in other projects

Will Bobo
  • 408
  • 4
  • 11
  • 1
    yes, you are right, but question is, is it possible to combine each AAR files in one AAR? Because there could be a lot of modules and all the time you have to include all of them in you app. It would be good to make one AAR (with all existing module AARs) and use it – vetalitet Jul 20 '15 at 15:27
  • You're right, I forgot the question by writing an answer. I searched for the same issue before. The main issue for merging AAR is ressources. Each have to be unique. Android Studio do that during build, merging AAR into one APK but do not merge AAR into AAR. – Will Bobo Jul 21 '15 at 08:36
  • I tried that once by using mutiple local AAR into one library project. I thought it would build an AAR from these but it failed. – Will Bobo Jul 21 '15 at 08:44
  • Same question here : http://stackoverflow.com/questions/20700581/android-studio-how-to-package-single-aar-from-multiple-library-projects – Will Bobo Jul 21 '15 at 08:52