Dave's Brain

Browse - Programming Tips - What's the best way to include an .aar that I make into several projects?

Date: 2017apr16
OS: Android
Language: gradle
Keywords: Android Studio

Q.  What's the best way to include an .aar that I make into several projects?

A.  There is all kind of advice out there.
I don't want to copy the .aar to the folder of each project that uses it -- a chore when it changes.
I don't want to make a submodule in the using project for the included .aar.
Here is my solution:

In the top-level build.gradle:

allprojects { repositories { jcenter() flatDir { // ADD THIS dirs 'e:/AndroidStudioProjects/SharedApp/shared/build/outputs/aar' } } }
In your app-level build.gradle:
dependencies { ... compile(name:'shared-release', ext:'aar') // ADD THIS }

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.