Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make single AAR file, having some other AAR files

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.

like image 566
vetalitet Avatar asked Jul 20 '15 14:07

vetalitet


People also ask

How do I add an AAR file to libs?

Add your AAR or JAR as a dependencyNavigate to File > Project Structure > Dependencies. In the Declared Dependencies tab, click and select Jar Dependency in the dropdown. In the Add Jar/Aar Dependency dialog, first enter the path to your . aar or .

What is a .AAR file?

An AAR file contains a software library used for developing Android apps. It is structurally similar to an . APK file (Android Package), but it allows a developer to store a reusable component that can be used across multiple different apps.


1 Answers

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

like image 139
Will Bobo Avatar answered Oct 01 '22 13:10

Will Bobo