How to reference without copying a library project on Android Studio?
Asked Answered
S

1

8

Yes, everywhere I can learn how to make a module from a project that will copy the library project. But that's no good, since a change in the library project would have to be replicated on every project that uses it. So, how can I reference it from a folder that's outside the project in a dynamic way?

Sapphirine answered 30/6, 2014 at 15:49 Comment(0)
S
18

Got it: In your project, go in settings.gradle and declare something like this: include ':LibReferenceName' project(':LibReferenceName').projectDir = new File(settingsDir, '../relativePath/toThe/libraryModule/fromTheProject')

And at the modules that requires the library, include something like this in the build.gradle of it: compile project(path: ':LibReferenceName')

You can also not use settingsDir and just put the absolute path of the project.

Sapphirine answered 2/7, 2014 at 19:39 Comment(2)
With AndroidX it's "implemention" instead of "compile", right?Sollows
Good thing this is about android studio then.Sapphirine

© 2022 - 2024 — McMap. All rights reserved.