1

What's the best way to include a non-static library project in Android Studio?

I've developed a library that is used by multiple projects and it is currently under active development. In Eclipse I can continue developing and include it in multiple projects just by being in the same workspace, is there an equivalent way to do it in AS?

When I make changes to the library source I don't want to have to keep copying the source manually into modules of all the dependent projects, and putting it on Maven is not an option. The library and all dependent projects are hosted in SVN.

Any ideas or suggestions? Thanks!

physphil
  • 233
  • 2
  • 9

2 Answers2

0

I'm not sure if this is the "right" or best way, but it works for me. I don't use SVN, so I have no idea how that would affect this methodology.

Where you specify sourcesets, you can specify additional directories. Suppose my library project's root directory is in the same directory as my current working project. I would change this line as shown under the sourcesets section:

java.srcDirs = ['src', '../myLibraryProject/src']

And you can do the same for res.srcDirs and so on as applicable.

This results in a funny looking directory tree, where it shows the additional source directory as a sibling to the project's root directory, and the project's own src directory is repeated as a sibling. I think this might be a bug, but it does allow me to go into the library project's source and edit it as if it is part of the same project.

Tenfour04
  • 83,111
  • 11
  • 94
  • 154
  • Thanks Tenfour04, I was pointed towards a similar solution (listed in my answer), which is working out well for me. – physphil Jul 22 '14 at 16:07
0

I was pointed in the direction of this question, which solved my issue perfectly - Add local Library Project as a dependency to multiple Projects in Android Studio

Community
  • 1
  • 1
physphil
  • 233
  • 2
  • 9